Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Moving Files

by JavaFan (Canon)
on Aug 07, 2008 at 16:42 UTC ( [id://702932]=note: print w/replies, xml ) Need Help??


in reply to Re: Moving Files
in thread Moving Files

The advantage is that on (modern) systems, mv works if the target location is on a different device than the original file. rename fails.

Replies are listed 'Best First'.
Re^3: Moving Files
by kyle (Abbot) on Aug 07, 2008 at 17:06 UTC
      Hmmm, let's not, shall we? At least, not if you care about your permission bits.
      $ touch /tmp/foo $ chmod -w+x /tmp/foo $ ls -l /tmp/foo $ -r-x------ 1 javafan staff 0 Aug 7 18:16 /tmp/foo $ perl -MFile::Copy -wE 'move "/tmp/foo", "/var/tmp/foo"' $ ls -l /var/tmp/foo $ -rw------- 1 javafan staff 0 Aug 7 18:16 /var/tmp/foo
      But with mv:
      $ touch /tmp/foo $ chmod -w+x /tmp/foo $ ls -l /tmp/foo $ -r-x------ 1 javafan staff 0 Aug 7 18:18 /tmp/foo $ mv /tmp/foo /var/tmp/foo $ ls -l /var/tmp/foo $ -r-x------ 1 javafan staff 0 Aug 7 18:18 /var/tmp/foo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-19 19:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found