Thanks for the quick response. I'll continue to investigate rsync. The move command is for moving files. In my opinion, having a safe flag in there fits the function of the command.
My first attempt with rsync resulted in the same problem I have when there are errors using the "mv" command:
$rsync -r --remove-source-files a/ b/
rsync: send_files failed to open "/tmp/test/a/2.txt": Permission denied (13)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1070) [sender=3.0.8]
The "a" directory was partially moved. This is no big deal with a small set of files, but a large set becomes a headache.
Mike
On Fri, Apr 5, 2013 at 12:42 PM, Eric Blake
<address@hidden> wrote:
On 04/05/2013 11:23 AM, Michael Boldischar wrote:
> Hello,
>
> This is a suggestion for a new feature in the "mv" command. This feature
> applies to moving directories. If a user moves a directory with a lot of
> files and encounters an error, it can often leave the source directory in a
> partially moved state. It makes it hard to redo the operation because the
> source directory has changed.
>
> The feature I'm looking for is a flag in the "mv" command that preserves a
> copy of the source directory until the entire tree has been successfully
> copied to the destination directory. At that point, the move command can
> delete the source directory. That way, a user can fix the error and rerun
> the same move command. It makes it easier and less of a headache.
>
> There might be other ways to accomplish this. But, I would use this
> feature all the time if it were available. I call it the "safe move
> operation."
This sounds like something that rsync can already do. In that case,
rather than wait for someone to write the feature into mv (and
successfully argue that it is not adding bloat), and then for that
feature to finally propagate into the distros that you commonly use; it
would be easier to figure out the appropriate rsync
--remove-source-files invocation that does what you want.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
--
Michael Boldischar
Research Fellow / IT Manager
University of Minnesota
Department of Civil Engineering
MAST Laboratory
University of Minnesota
2525 4th Street SE
Minneapolis, MN 55455
Desk Phone: 612-626-9562
Cellphone: 651-387-0223
Fax: 612-624-5964