I have a program that reads some directories and copies those files to dynamically created. The thing is shutil.copy() keeps failing in some files because they have special characters like ',&,(,),',' so I want to know how to escape them dynamically also. This destination path is created dynamically and just by appending the string, not with any other function or similars.
Ex:
path = "/home/path/ma/gex/%s/%s/%s/" % (d[c][0],d[c2][1].upper(),driveDict[c2][1])
Shutil.copy keeps throwing the exception that the directory doesn't exist, but it's already created, so it can't find the dir. Any help on how to escape this characters or make shutil read them?
EDIT: Files are in a Linux Server, already copied ~10000 files without special chars.