I have a list of folders and sub-folders with files in arranged as follows:
abcd>>one, two, three,other,junk.
abcde>>one,two,three,junk,not needed
Essentially I want to copy only the subfolders and files contained that are named one,two, three and ignore all others. So for the first example the desired structure would be abcd>> one, two, three with appropriate files retained in folders one, two and three
import os,shutil
src = "C:\\Users\\EM\\Desktop\\files\\"
dest = "C:\\Users\\EM\\Desktop\\new_files\\"
shutil.copytree(scr,dest,ignore=None)
The above code copies all folders and subfolders however when I try to pass the name of a subfolder in ignore I get an error. TypeError: 'str' object is not callable
import os, shutil
src = "C:\\Users\\EM\\Desktop\\files\\"
dest = "C:\\Users\\EM\\Desktop\\new_files\\"
files_ignore="other"
shutil.copytree(src,dest,ignore=files_ignore)
any guidance would be most helpful