Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Moving folders with content

Reply
Thread Tools

Re: Moving folders with content

 
 
Laszlo Nagy
Guest
Posts: n/a
 
      09-15-2012
On 2012-09-15 06:36, 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Moving folders with content Python 4 09-16-2012 08:53 PM
Moving folders with content Python 2 09-15-2012 10:52 AM
error: Only Content controls are allowed directly in a content page that contains Content controls. hazz ASP .Net 6 06-09-2010 01:54 PM
Free Moving Estimate, Local Movers, Long Distance Moving, PackingSupplies, Storage Rental, Home Moving, Apartment Moving, Office Moving,Commercial Moving linkswanted ASP .Net 0 01-06-2008 04:45 AM
Syncing POP folders with IMAP folders Rich Computer Support 1 02-12-2004 09:36 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57