Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29370

Re: Moving folders with content

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <gandalf@shopzeus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status UNSURE 0.578
X-Spam-Level *****
X-Spam-Evidence '*H*': 0.08; '*S*': 0.24; 'wrote:': 0.17; 'bit': 0.21; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'looks': 0.26; 'this?': 0.28; 'finds': 0.29; 'servers.': 0.29; 'case,': 0.29; 'source': 0.29; "i'm": 0.29; 'code': 0.31; 'curious': 0.33; 'anyone': 0.33; 'to:addr:python-list': 0.33; '(with': 0.33; 'received:192.168.0': 0.35; 'similar': 0.35; 'but': 0.36; 'subject:with': 0.36; 'rather': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'hello,': 0.39; 'received:192.168': 0.40; 'remove': 0.61; 'back': 0.62; 'received:62': 0.62; 'different': 0.63; 'wanting': 0.65; 'believe': 0.69; 'computers.': 0.84; 'received:192.168.0.101': 0.84; 'received:192.168.13': 0.84; 'received:62.179': 0.84; 'received:62.179.121': 0.84; 'received:upcmail.net': 0.84; 'researching': 0.84; 'subject:Moving': 0.84; 'subject:content': 0.84; 'careful': 0.91; 'faster.': 0.91; 'snow': 0.91
X-SourceIP 89.134.225.226
Date Sat, 15 Sep 2012 08:36:10 +0200
From Laszlo Nagy <gandalf@shopzeus.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Moving folders with content
References <20120915043600.VOQ3T.118012.root@cdptpa-web22-z01>
In-Reply-To <20120915043600.VOQ3T.118012.root@cdptpa-web22-z01>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Mailman-Approved-At Mon, 17 Sep 2012 09:31:28 +0200
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.827.1347867090.27098.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1347867090 news.xs4all.nl 6859 [2001:888:2000:d::a6]:37421
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29370

Show key headers only | View raw


On 2012-09-15 06:36, jyoung79@kc.rr.com wrote:
> Hello,
>
> I am working in both OS X Snow Leopard and Lion (10.6.8 and 10.7.4).
> I'm simply wanting to move folders (with their content) from various
> servers to the hard drive and then back to different directories on the
> servers.
>
> I want to be careful not to remove any metadata or resource forks from
> the files in the directories.  I did a bit of researching on shutil, and
> looks like it is similar to using "cp -p" and copystat(), which I believe
> will keep the resource fork, etc.
>
> Here's the code I came up with.  I'm curious if anyone finds fault with
> this, or if there's a better way to do this?
Not in this particular case, because you know that these directories are 
on different computers. But instead of rmtree+copytree, I would rather 
use shutil.move() because it will use os.rename() when the source and 
the destination are on the same filesystem. Much much faster.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Moving folders with content Laszlo Nagy <gandalf@shopzeus.com> - 2012-09-15 08:36 +0200

csiph-web