how to copy and move file with its attribute?

MRAB python at mrabarnett.plus.com
Mon Jul 19 14:09:55 EDT 2010


Alban Nona wrote:
> Hello Mrab,
> 
> Thank you very much for this informations.
> Homever, Im still stuck with a problem:
> 
> import os
> import sys
> import threading
> import shutil
> 
> source= "C://Production//"
> dest= "D://Production//"
> 
> os.system('xcopy /E /I /Q "%s" "%s"' % (source, dest))
> 
> 
> It seems that it wont copy the files
> 
> File not found - //Production//
> 0 File(s) copied
> 
> any idea of why its doing this please ?
> 
[snip]
If you're using slashes then there's no need to double them. Also, you
don't need to end the folder names with slashes or backslashes (except
for root folders). That's what it doesn't like, apparently.

     source = "C:/Production"
     dest = "D:/Production"

     os.system('xcopy /E /I /Q "%s" "%s"' % (source, dest))



More information about the Python-list mailing list