Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29291
| Date | 2012-09-16 08:02 +0000 |
|---|---|
| From | <jyoung79@kc.rr.com> |
| Subject | RE: Moving folders with content |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.785.1347782537.27098.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
RE: Moving folders with content <jyoung79@kc.rr.com> - 2012-09-16 08:02 +0000
Re: Moving folders with content Hans Mulder <hansmu@xs4all.nl> - 2012-09-16 12:40 +0200
Re: Moving folders with content Nobody <nobody@nowhere.com> - 2012-09-16 15:31 +0100
Re: Moving folders with content Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-16 14:53 -0400
Re: Moving folders with content Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-16 16:53 -0400
csiph-web