how to copy and move file with its attribute?

Alban Nona python.koda at gmail.com
Mon Jul 19 13:55:16 EDT 2010


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 ?


2010/7/19 MRAB <python at mrabarnett.plus.com>

> Alban Nona wrote:
>
>> Hello,
>>
>> About this one. I tried the os.system copy. But it seems I cant find the
>> right syntax.
>>
>> *os.system ("xcopy /s %s %s" % (dirname1, dirname2))*
>>
>> This one seems to not working.
>>
>>  In what way doesn't it work?
>
> If the names contain spaces then you need to quote them:
>
>
>    os.system('xcopy /s "%s" "%s"' % (dirname1, dirname2))
>
> (It's easier to always quote them.)
>
> If the destination doesn't exist then you need to add the "/i" flag:
>
>    os.system('xcopy /s /i "%s" "%s"' % (dirname1, dirname2))
>
>
>  Is there anyway I can do this way:
>>
>> localpath= c:\
>> networkpath=g:\
>>
>> os.system("copy localpath networkpath)
>>
>> I tried many variations, but still not working. Any help will apreciated
>> :/
>>
>>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100719/53f2f1fb/attachment-0001.html>


More information about the Python-list mailing list