Problem
One day, my boss request me :
Can you make me a python script to move all file in "this" folder to "that" folder, so i can automate backup "this" folder and the code must replace file with same name to "that" folder
Logic
We can use function "copy_tree", because that script will move all file and subfolder in specified folder and the function will replace same file
1. import library function "copy_tree"
2. Record path to "this" folder to variable "fromDirectory"3. Record path to "that" folder to variable "toDirectory"
4. Use function "copy_tree" to move and replace file with same name
5. save python script in any folder you want
6. create task schedule for automate
Solution
Make new python with the following script :
from distutils.dir_util import copy_tree fromDirectory = "'this' folder path" toDirectory = "'that' folder path" copy_tree(fromDirectory, toDirectory)
save script, and make task schedule to autorun script