Henrik Carlqvist wrote:
> To get the behaviour you want it might be easier to use tar:
> 
> tar --remove-files -cf - . | ( cd /new/path ; tar -xvf - )
> 
> Tar will give you some ugly error messages directories changing and being
> unable to remove current directory but at least the files will be copied
> and removed in the order that you want.

That tar command feels scary to me in the face of crashes.  The
oringinal message brought up the problem of disconnecting a usb drive
while in the middle of a copy.  In the case of using mv if the copy
fails then the source will not be removed.  Reattaching the drive and
then restarting the mv command is possible.

In the tar --remove-files case the data may still be in transit.  Some
files will be in the pipeline between the commands but will have been
removed from the filesystem already by the first tar before the second
tar can write the data to disk.  A failure during the copy risks
losing the file in the pipeline.

Bob


Reply via email to