-1

I have been trying to make a python file that will copy contents from one folder to another. I would like it to work on any Windows system that I run it on. It must copy ALL things .

i need solution to this problem.

  • Hey, welcome to the stack! Please show your own efforts (code!) and provide an [MRE](https://stackoverflow.com/help/minimal-reproducible-example). What is the **specific** problem you are running into? (Error message, ...). – Cpt.Hook Dec 11 '22 at 13:05
  • Duplicate..Does this answer your question? [Copy multiple files in Python](https://stackoverflow.com/questions/3397752/copy-multiple-files-in-python) – Bhargav - Retarded Skills Dec 11 '22 at 13:07
  • You may also take a look at this question https://stackoverflow.com/questions/123198/how-to-copy-files – bilaljo Dec 11 '22 at 13:08
  • I assume you used [`copytree`](https://docs.python.org/3.9/library/shutil.html#shutil.copytree) when you tried it yourself. Could you please tell us where you encountered problems when you did that? – Matthias Dec 11 '22 at 13:13
  • Please provide enough code so others can better understand or reproduce the problem. – Community Dec 11 '22 at 20:24

1 Answers1

0

You can use the copytree function of the shutil library:

import shutil

source_folder = "C:\\Users\\user1\\source_folder"

destination_folder = "C:\\Users\\user1\\destination_folder"

# Copy the contents of the source folder to the destination folder
shutil.copytree(source_folder, destination_folder)
Robinho
  • 21
  • 2