Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'exist,': 0.07; 'received:mail.rr.com': 0.07; 'cmd': 0.09; 'macos': 0.09; 'received:10.127': 0.09; 'received:75.180': 0.09; 'received:75.180.132': 0.09; 'received:cdptpa-omtalb.mail.rr.com': 0.09; '\'"\'': 0.16; 'subprocess': 0.16; 'bytes': 0.17; '>>>': 0.18; 'module': 0.19; 'import': 0.21; 'looks': 0.26; 'run': 0.28; 'maybe': 0.29; 'folder': 0.30; 'received:rr.com': 0.30; 'file': 0.32; 'like:': 0.33; 'to:addr:python-list': 0.33; 'direction': 0.35; 'something': 0.35; 'subject:with': 0.36; 'thank': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'copying': 0.38; 'received:10': 0.38; 'to:addr:python.org': 0.39; 'from:no real name:2**0': 0.60; 'subject:Moving': 0.84; 'subject:content': 0.84 Authentication-Results: cdptpa-omtalb.mail.rr.com smtp.user=jyoung79@kc.rr.com; auth=pass (LOGIN) X-Authority-Analysis: v=2.0 cv=H+ZZMpki c=1 sm=0 a=05ChyHeVI94A:10 a=IkcTkHD0fZMA:10 a=ayC55rCoAAAA:8 a=AEITc67NsEEA:10 a=HSaJdv4jWVtbJpavjeQA:9 a=QEXdDO2ut3YA:10 a=Wm8N4nQisXyE0hqNaTxyMw==:117 X-Cloudmark-Score: 0 Date: Sun, 16 Sep 2012 8:02:09 +0000 From: To: python-list@python.org Subject: RE: Moving folders with content MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) Sensitivity: Normal X-Originating-IP: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1347782537 news.xs4all.nl 6944 [2001:888:2000:d::a6]:51957 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29291 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