in reply to Moving Files

1. rename
Please don't execute another program to do that (system(mv))- a kitten dies each time you run a child process (honest).

Other questions already answered

Replies are listed 'Best First'.
Re^2: Moving Files
by JavaFan (Canon) on Aug 07, 2008 at 16:42 UTC
    The advantage is that on (modern) systems, mv works if the target location is on a different device than the original file. rename fails.
        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
Re^2: Moving Files
by Lawliet (Curate) on Aug 07, 2008 at 16:39 UTC

    Ouch. Low blow -.-

    :P

    <(^.^-<) <(-^.^<) <(-^.^-)> (>^.^-)> (>-^.^)>