help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question about the "copy, then remove" behaviour of mv


From: Bob Proulx
Subject: Re: question about the "copy, then remove" behaviour of mv
Date: Mon, 26 Oct 2009 03:01:33 -0600
User-agent: Mutt/1.5.18 (2008-05-17)

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

[Prev in Thread] Current Thread [Next in Thread]