Re: mv command behavior

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

 



lists@xxxxxxxxxxx wrote:
> Hi, I don't know if I already sent this question or not, my server
> died before, and I havn't been able to receive the mails for a
> while.
>
> I want to move the files from one dir to another, but only if they
> are newer. So I do:
>
> mv -u /tmp/dirA/dirB /dirC/dirB
>
> Meaning moving it from being a subdir of /tmp/dirA to be a subdir of
> /dirC.
>
> The first time it works, but the next time it will end up being like
> this:
>
> /dirC/dirB/dirB :(
>
> Could I use the "cp -ru" instead with some other flag to remove
> files successfully copied?

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.

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drugs may lead to nowhere, but at least it's the scenic route.

Attachment: pgpRz0rJQTnfZ.pgp
Description: PGP signature

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux