[Tutor] copy directory from one part to another and preserve permissions
Norman Khine
norman at khine.net
Thu May 27 14:12:58 CEST 2010
hello,
i have this code:
if i want to copy the 'files' directory contents and preserve
permissions is this the right way to do this?
import shutil
path_to_old_files_dir = '/var/www/dev.site.com/htdocs/files'
path_to_new_files_dir = '/var/www/site.com/htdocs/sites/default/files'
shutil.rmtree(path_to_new_files_dir)
shutil.copytree(path_to_old_files_dir, path_to_new_files_dir)
thanks
norman
--
˙uʍop ǝpısdn p,uɹnʇ pןɹoʍ ǝɥʇ ǝǝs noʎ 'ʇuǝɯɐן sǝɯıʇ ǝɥʇ puɐ 'ʇuǝʇuoɔ
ǝq s,ʇǝן ʇǝʎ
%>>> "".join( [ {'*':'@','^':'.'}.get(c,None) or
chr(97+(ord(c)-83)%26) for c in ",adym,*)&uzq^zqf" ] )
More information about the Tutor
mailing list