Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re[2]: move files revisited

by tokpela (Chaplain)
on May 01, 2009 at 08:36 UTC ( #761233=note: print w/ replies, xml ) Need Help??


in reply to move files revisited

This seems like a job for the dirmove command in the File::Copy::Recursive module.

# (untested) use strict; use warnings; use File::Copy::Recursive qw(dirmove); my $dir= "c:/startdir"; my $dir2="c:/mlx"; if (dirmove($dir1,$dir2)) { print "MOVED DIRECTORY [$dir1] TO [$dir2]\n"; } else { print "[Error] UNABLE TO MOVE DIRECTORY [$dir1] TO [$dir2] - [$!]\n" +; }
BTW: I would always use forward slashes in filepaths on Windows. It works the same and you never have to worry about the escaping issues of backslashes. Not to mention that your code is more portable too :-)


Comment on Re[2]: move files revisited
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://761233]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2014-11-28 19:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (200 votes), past polls