Python Forum
Copy folders to newly created folder and append
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Copy folders to newly created folder and append
#5
This created new Working folder but for some reason it does not coy created folders from Python_1, any idea where the error is:



import os
import shutil

root_path = r"C:\GEOS455\Assign2"
new_main_folder = 'Working'

new_root_path = os.path.join(root_path, new_main_folder)
os.mkdir(new_root_path)

list_dir = []  
for directory in list_dir:
    src = os.path.join(root_path, directory)  
    dest = os.path.join(new_root_path, directory + '_working')  
    shutil.copytree(src, dest)
Reply


Messages In This Thread
RE: Copy folders to newly created folder and append - by Filthy_McNasty - Feb-21-2017, 03:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Why is the copy method name in python list copy and not `__copy__`? YouHoGeon 2 1,328 Apr-04-2024, 01:18 AM
Last Post: YouHoGeon
  Compare folder A and subfolder B and display files that are in folder A but not in su Melcu54 3 1,465 Jan-05-2024, 05:16 PM
Last Post: Pedroski55
  Why does newly-formed dict only consist of last row of each year? Mark17 6 2,253 Nov-17-2023, 05:28 PM
Last Post: Mark17
  Create new folders and copy files cocobolli 3 4,374 Mar-22-2023, 10:23 AM
Last Post: Gribouillis
  Copy only hidden files and folders with rsync Cannondale 2 2,265 Mar-04-2023, 02:48 PM
Last Post: Cannondale
  Code to check folder and sub folders for new file and alert fioranosnake 2 2,940 Jan-06-2022, 05:03 PM
Last Post: deanhystad
  Compare filename with folder name and copy matching files into a particular folder shantanu97 2 6,282 Dec-18-2021, 09:32 PM
Last Post: Larz60+
  Move file from one folder to another folder with timestamp added end of file shantanu97 0 3,113 Mar-22-2021, 10:59 AM
Last Post: shantanu97
  code to read files in folders and transfer the file name, type, date created to excel Divya577 0 2,415 Dec-06-2020, 04:14 PM
Last Post: Divya577
  Python Cut/Copy paste file from folder to another folder rdDrp 4 6,760 Aug-19-2020, 12:40 PM
Last Post: rdDrp

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020