Re: mv and exlude list

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

 



On Thu, May 7, 2009 at 8:38 AM, Guillaume CHARDIN
<guillaume.chardin@xxxxxxxxx> wrote:
>
> Hi, maybe some scripting genius gonna help me :D
>
> I need to move some file from one directory to other with some exclusions.
> Ex: move files from "/data/product/" to "/data/archives/2005" while
> the "*.dat" file/dirs stay in the right place.
>
> $mv /data/product/* !(/data/product/*.dat) /data/archives/2005
>
>
> If you have a solution, please tell me :)
> Thanks for your time.
>

No genius here, but a solution would be using rsync

rsync -auv --exclude='*.dat' --remove-source-files /data/product
/data/archives/2005/

replace the -avu with -avun for a dry (test) run. The disadvantage is
that files are copied, not moved, so it will take longer.

Alternatively, make a tmp directory somewhere, then

mv /data/product/*.dat /tmp
mv /data/product/* /data/archives/2005/
mv /tmp/* /data/product/

This should also do what you want (?)

Peter

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[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