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: Henrik Carlqvist
Subject: Re: question about the "copy, then remove" behaviour of mv
Date: Mon, 26 Oct 2009 07:53:44 +0100
User-agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.)

Musaul Karim <musaul@googlemail.com> wrote:
> When I run ...
> 
>   $ mv -v 1 /var/tmp/
> 
> ... on a two level deep directory structure with files file1 to 5

> I'll try the 'find' way the next time I need to copy
> large numbers of files.

Ouch, I got the impression that you only were moving files, not
recursively moving directories. The solution I gave with find will not
help as it only makes sure that each directory is completely moved in
order.

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.

regards Henrik
-- 
The address in the header is only to prevent spam. My real address is:
hc3(at)poolhem.se Examples of addresses which go to spammers:
root@localhost postmaster@localhost



reply via email to

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