Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: How do I copy an empty directory?

by kcott (Chancellor)
on Oct 02, 2012 at 21:15 UTC ( #996921=note: print w/replies, xml ) Need Help??

in reply to How do I copy an empty directory?

Have you tried File::Copy?

Your node title has "How do I copy ..."; your node content has "How can I move ...". File::Copy has functions for both operations.

Update: It appears I was wrong about the copy() part; although, move() seems to work fine. See discussion below.

-- Ken

Replies are listed 'Best First'.
Re^2: How do I copy an empty directory?
by Anonymous Monk on Oct 03, 2012 at 00:58 UTC
    Correct me if I am wrong, but File::Copy copies files and not directories.

      Well, it seems you're correct with respect to File::Copy::copy(); however, File::Copy::move() seems to work fine.

      I tried copy() on an empty directory and just got an empty (normal) file. I then tried move() on an empty directory and that worked; move() on a populated directory also worked, i.e. moved the directory and its contents.

      If you're the OP, sorry for the bum steer. I'll update my post.

      -- Ken

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://996921]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2018-06-18 00:32 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (107 votes). Check out past polls.