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


Groups > comp.lang.python > #29370

Re: Moving folders with content

Date 2012-09-15 08:36 +0200
From Laszlo Nagy <gandalf@shopzeus.com>
Subject Re: Moving folders with content
References <20120915043600.VOQ3T.118012.root@cdptpa-web22-z01>
Newsgroups comp.lang.python
Message-ID <mailman.827.1347867090.27098.python-list@python.org> (permalink)

Show all headers | 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