1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Neporo4naja [7]
3 years ago
15

Write a program that

Computers and Technology
1 answer:
Lemur [1.5K]3 years ago
7 0

Answer:

import os

import shutil

# directory holding the file to be used

curr_path = "C:\\Users\\user\\Desktop\\test"

# change to the target directory absolute path

os.chdir(curr_path)

# create new folder  in current directory

os.mkdir('C:\\Users\\user\\Desktop\\newFolder')

 

for root, dirs, files in os.walk("."):

   for name in files:

       # check if it is pdf

       if name.endswith(".pdf"):

           # find path

           path = os.path.join(root, name)

           # find size

           size = os.stat(path).st_size

           # print absolute path and size

           print(os.path.abspath(path), "\t", size)

           # copy  the file to the new folder

           shutil.copy(path, 'C:\\Users\\user\\Desktop\\newFolder\\'+name)

Explanation:

The python program uses the os and shutil python module, which is used to interact with the computer system operating system to get the absolute path of all the pdf text files using the os.walk() method to create an iterator to loop over, printing the path string and the file size. The shutil.copy() is used to make a copy of each pdf file in the new folder.

You might be interested in
Discuss advantages and disadvantages of operating system
Serjik [45]

Answer and Explanation:

Advantages-

  1. Computing source- Through the operating system, users can communicate with computers to perform various functions such as arithmetic calculations and other significant tasks.
  2. Safeguard Of Data- There’s a lot of user data stored on the computer. Windows Defender in Microsoft Windows detects malicious and harmful files and removes them. Also, it secures your data by storing them with a bit to bit encryption.
  3. Resource Sharing- Operating systems allow the sharing of data and useful information with other users via Printers, Modems, Players, and Fax Machines. Besides, a single user can share the same data with multiple users at the corresponding time via mails. Also, various apps, images, and media files can be transferred from PC to other devices with the help of an operating system.

Disadvantages-

  1. Expensive- It is costly.
  2. System Failure- System failures may occur. If the central operating system fails, it will affect the whole system, and the computer will not work. If the central system crashes, the whole communication will be halted, and there will be no further processing of data.
  3. Virus Threats- Threats to the operating systems are higher as they are open to such virus attacks. Many users download malicious software packages on their system which halts the functioning of OS and slow it down.

4 0
3 years ago
Read 2 more answers
(5 pt.) The name of a variable in the C programming language is a string that can contain uppercase letters, lowercase letters,
lilavasa [31]

Answer:

The different variable in C is 21213316700.

Explanation:

Given value:

Total value  = letters + underscore value

Total value  = 52 + 1

Total value =53

choice for first character = 53 letters +10 digits

first character = 63

choice for remaining characters

So,

Variable number With one 1 character = 53

Variable number With 2 character  = 53 × 63

Variable number With 3 character = 53 × 63²

Variable number With 4 character  = 53 × 63³

.

.

.

Variable number With 7 character  = 53 \times  63^{7}

Total difference variable = 53 + 53 × 63+ 53 × 63²+ 53 × 63³+....+ 63^{7}

Total difference variable = 53(1 + 63 + 63²+ 63³+ .... + 63^{7})

Formula:

1+x+x^2+x^3+x^4+........x^n\\\\\Rightarrow  \frac{x^{(n+1)} -1}{x-1}

Total difference variable

53 \times \frac{63^{7+1} -1 }{63-1}\\\\53 \times \frac{63^{8} -1 }{63-1} \\\\ \therefore 63^8 = 2.48 \times 10^{14}\\\\53 \times \frac{2.48 \times 10^{14} -1  }{62}\\\\53 \times \frac{1.48 \times 10^{14}}{62}\\\\21213316700

6 0
3 years ago
Solesbee v. Balkcom (1950) was one of two cases that challenged the constitutionality of capital punishment prior to 1968. What
Karo-lina-s [1.5K]

Answer:

Whether a governor is allowed to determine an inmates sanity where finding an inmate insane would prevent his or her execution

Explanation:

The Solesbee v. Balkcom (1950) was a case where a state in its policy was against the execution of convicts who goes insane after being convicted and sentenced. According to this case, under the Fourteenth Amendment, such is not considered denial of due process if the governor is vested with the power to determine if a convict is insane after sentence or not, and if he is actually insane, a governor should be the one to say if the convict is to put in an insane asylum.

4 0
3 years ago
Opposite word of reassembling​
Marysya12 [62]
<h3>OPPOSITE WORDS OF REASSEMBLING</h3>

  • disperse
  • disband
  • separate
8 0
3 years ago
Read 2 more answers
You would like to find the average of cells C2, C3, and C4. What should the formula look like? = C2+C3+C4*3 =C2+C3+C4/3 =(C2+C3+
Marizza181 [45]

Answer:

c3 and c4 and c2 are different and same

Explanation:

average cells are ptoboxide

3 0
4 years ago
Read 2 more answers
Other questions:
  • 1 what elements of composition are under your control in photoshop
    13·1 answer
  • A range of cells can be converted into an Excel ________ so that the data can be analyzed
    7·1 answer
  • How can rows be added to a table? Check all that apply
    13·2 answers
  • how do i create an advanced search using the search criteria in the range K2:S3 and the inventory data where the results will be
    8·1 answer
  • The next thing Maria wants to do is to indent the first line of her paragraph how dose she do it
    10·2 answers
  • All nuclear energy results in the rapid release of energy, such as in atomic bombs. true or false
    8·1 answer
  • _____ is a method of computing that delivers secure, private, and reliable computing experiences based on sound business practic
    7·1 answer
  • Use a for/else loop to traverse through the key names in the dictionary below in order to find Mr. Potatohead’s mailing address.
    7·1 answer
  • Henry is planning to visit Spain for a vacation. He wants to learn Spanish, but he prefers to do it in a fun way. He searches on
    8·2 answers
  • The border to the right of a column is called the ____.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!