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


Groups > comp.lang.python > #29370 > unrolled thread

Re: Moving folders with content

Started byLaszlo Nagy <gandalf@shopzeus.com>
First post2012-09-15 08:36 +0200
Last post2012-09-15 08:36 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#29370 — Re: Moving folders with content

FromLaszlo Nagy <gandalf@shopzeus.com>
Date2012-09-15 08:36 +0200
SubjectRe: Moving folders with content
Message-ID<mailman.827.1347867090.27098.python-list@python.org>
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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web