Re: Moving folders with content

Discussion in 'Python' started by Laszlo Nagy, Sep 15, 2012.

  1. Laszlo Nagy

    Laszlo Nagy Guest

    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.
     
    Laszlo Nagy, Sep 15, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. linkswanted
    Replies:
    0
    Views:
    1,274
    linkswanted
    Dec 21, 2007
  2. linkswanted
    Replies:
    0
    Views:
    1,609
    linkswanted
    Jan 6, 2008
  3. linkswanted
    Replies:
    0
    Views:
    472
    linkswanted
    Jan 23, 2008
  4. Guest

    Moving folders with content

    Guest, Sep 15, 2012, in forum: Python
    Replies:
    2
    Views:
    230
    Hans Mulder
    Sep 15, 2012
  5. Guest
    Replies:
    4
    Views:
    239
    Dennis Lee Bieber
    Sep 16, 2012
Loading...

Share This Page