Moving folders with content
jyoung79 at kc.rr.com
jyoung79 at kc.rr.com
Sun Sep 16 04:02:09 EDT 2012
Thank you "Nobody" and Hans!
> You may want to use the subprocess module to run 'ditto'. If
> the destination folder does not exist, then ditto will copy MacOS
> specific aspects such as resource forks, ACLs and HFS meta-data.
This looks like a good direction to go. Maybe something like:
>>> import os
>>> import subprocess
>>>
>>> p1 = os.path.expanduser('~/Desktop/IN/Test/')
>>> p2 = os.path.expanduser('~/Desktop/OUT/Test/')
>>>
>>> cmd = 'ditto -vV "' + p1 + '" "' + p2 + '"'
>>>
>>> v = subprocess.check_output(cmd, shell=True)
>>> Copying /Users/jay/Desktop/IN/Test/
copying file ./.DS_Store ...
6148 bytes for ./.DS_Store
copying file ./dude.txt ...
4 bytes for ./dude.txt
copying file ./new.png ...
114469 bytes for ./new.png
Jay
More information about the Python-list
mailing list