homedir, file copy

MRAB python at mrabarnett.plus.com
Sun Jan 30 19:09:10 EST 2011


On 30/01/2011 23:43, ecu_jon wrote:
> ok now i get permission denied....
>
> import os
> homedir = os.path.expanduser('~')
> try:
>      from win32com.shell import shellcon, shell
>      homedir = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0)
>
> except ImportError:
>      homedir = os.path.expanduser("~")
> print homedir
> print os.listdir(homedir+"\\backup\\")
> #homedir.replace("\\\\" , "\\")
> #print homedir
> backupdir1 = os.path.join(homedir, "backup")
> backupdir2 = os.path.join(homedir, "backup2")
> shutil.copy (backupdir1, backupdir2)
>
shutil.copy(...) copies files, not directories. You should use
shutil.copytree(...) instead.



More information about the Python-list mailing list