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
What key do I use to start my presentation
Len [333]

Answer:

The answer to this question is given below in this explanation section.

Explanation:

Knowing how o start a presentation is crucial if you fail to capture the audience attention right of the bat your entire presentation will flop.Few listeners will stick with you to the end and retain what you have told.

That is mildly unpleasant when you are doing an in house presentation in front of your colleagues.But can become utterly embrassing when you are presenting in front of larger audience presentation to prospective customers.

Let you have most of your presentation slides and polished up you dont check and quick and effective power point presentation design tips.Many ideas are broken into bits sized statements for your slides and complemented with visuals.The best way is to appeal and invoke certain emotions with your audience curiosity,surprise fear or good old amusements.

8 0
3 years ago
Which expression is equivalent to 3x + 3x + 3x?<br><br> From Performance Matters
mamaluj [8]
9x because you can add 3x+3x+3x because they are the same and can be added
3 0
3 years ago
Read 2 more answers
A ________ is a system of hardware and software that stores user data in many different geographical locations and makes that da
castortr0y [4]

Answer:

Content delivery network.

Explanation:

The content delivery network is also known as a network of content distribution it is a globally decentralized network of the proxy servers and the server farms.The main aim of a content delivery network is to giving the insularity of the high accessibility and efficiency by distributing the service to the end-user.

The content delivery network is a type of hardware and software network that stores u data in different geographical locations also giving the data available on the request.

7 0
3 years ago
Write code to print the location of any alphabetic character in the 2-character string passCode. Each alphabetic character detec
Flauer [41]

Answer:

//Program written in Java Programming Language

// Comments are used for explanatory purpose

import java.util.Scanner; //Scanner Library Imported

public class findloc { //Program Class Declared

public static void main (String [] args) {//Program Main Method

Scanner input = new Scanner(System.in);

string passCode; // Declare string passCode

passCode = Input.next();//Input Passcode

if(Character.isLetter(passCode.charAt(0)))//Check Alphabet Position

{

System.out.println("Alphabetic at 0");//Print Alphabet position is at 0

}

if(Character.isLetter(passCode.charAt(1))) //Check Alphabet Position

{

System.out.println("Alphabetic at 1");//Print Alphabet position is at 1

}

}

}

4 0
3 years ago
What is a BUG in terms of computer programming?
diamong [38]

Answer:

C

Explanation:

4 0
3 years ago
Other questions:
  • Most of the pollution in the ocean comes from:
    11·1 answer
  • How does a main program recieve info from a function in c++?
    6·1 answer
  • After installation of SSL certificate website asking for username and password.
    6·1 answer
  • Consider a system running 10 I/O-bound processes and 2 CPU-bound process. Assume that the I/O-bound processes issue an I/O opera
    9·1 answer
  • When at the rightmost cell in a row, press the ENTER key to move to the first cell in the next row; do not press the TAB key.
    14·1 answer
  • In order to view the permissions assigned to each type of user for all the files located in a directory, which of the following
    12·1 answer
  • Which is the correct expansion of the term Internet?
    14·2 answers
  • True or false As the contents and topics of new magazines change year-to-year, you can see various trends and movements across s
    15·1 answer
  • Definition of Computer forensics?
    12·2 answers
  • True or false. A plug-in card is always required to support pc sound
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!