in reply to file::move and networks

since move can fail...and windows OS doesn't handle that very well. it's better to "copy", then check that all files got there (file sizes), and then delete originals OR move them to a local backup location. a failed move on windows OS can leave you with half of the directory on each server, with a couple of corrupt files as well.
the hardest line to type correctly is: stty erase ^H

Replies are listed 'Best First'.
Re^2: file::move and networks
by BrowserUk (Patriarch) on Jul 16, 2007 at 06:23 UTC
    since move can fail...and windows OS doesn't handle that very well.
    1. It's the unix move semantics, silently overwriting a protected file, that suck.
    2. In you look inside File::Copy at the move()/mv() routine, it uses a 'delete if necessary and copy' process on windows anyway.

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      It's the unix move semantics, silently overwriting a protected file, that suck.

      Un*x does not do that, you need 'mv -f file1 file2' to force the mv on existing file...o maybe I did not get your comment. Now if a command tries to enforce or not (vi does e.g) the w bit on a file is another problem.

      cheers --stephan
        Un*x does not do that, you need 'mv -f file1 file2' to force the mv on existing file.
        No, you don't.
        $ echo foo >foo $ echo bar >bar $ mv foo bar $ cat bar foo $ uname -a Linux raven 2.6.22-8-generic #1 SMP Thu Jul 12 15:59:45 GMT 2007 i686 +GNU/Linux $ mv --version mv (GNU coreutils) 5.97
        and from the info page:
        If a destination file exists but is normally unwritable, standard input is a terminal, and the `-f' or `--force' option is not given, `mv' prompts the user for whether to replace the file. (You might own the file, or have write permission on its directory.) If the response is not affirmative, the file is skipped.
        Un*x does not do that, you need 'mv -f file1 file2' to force the mv on existing file

        That's not true. The default behavior for cp, rm, and mv is to behave as if '-f' was specified on the command line.

        I think you are confused because all three of these commands are usually aliased to 'cp -i', 'rm -i', and 'mv -i' respectively. Run 'alias' to see this. The '-f' option is useful because it overrides the '-i', though you could also escape the alias ('\mv') or full path the comamnd ('/bin/mv') to achieve the same results.