mv command behavior
Les Mikesell
lesmikesell at gmail.com
Tue Jul 10 06:34:55 UTC 2007
Peter Lauri wrote:
>> I would suggest rsync for this task. You could use it to sync
>> /tmp/dirA/dirB with /dirC/dirB, deleting files not in /tmp/dirA/dirB
>> from /dirC/dirB something like this:
>>
>> $ rsync -av --delete /tmp/dirA/dirB/ /dirC/dirB/
>>
>> The trailing slashes are significant, so check out the rsync man page
>> for more details.
>>
>
> [Peter Lauri - DWS Asia]
>
> Hi,
>
> But I just want to perform a simple move. This will perform a copy of the
> files, and remove files in /dirC/dirB that should still be there.
>
> After the copy of the file is completed, the file in the SOURCE should be
> deleted. But --delete will delete files from the DESTINATION that are not in
> SOURCE, so the complete opposite of what I want :)
>
> I assume I have to write my own script for this that copies FILE BY FILE and
> checks if it was copied correctly, and then delete it from the tmp dir.
Rsync will do the copy - and it does it in such a way that incomplete
copies don't show up. After an rsync run your script can just get the
list of files from the destination directory and remove them from the
source - unless the source directory is concurrently updated with new
files of the same name.
--
Les Mikesell
lesmikesell at gmail.com
More information about the fedora-list
mailing list