Re: mv and exlude list

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

 



On Thu, 2009-05-07 at 17:38 +0200, Guillaume CHARDIN 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

Two solutions using mv and bash's glob control features:

$ shopt -s extglob    # enable extended globbing
$ cd /data/product    # effective on basenames only
$ mv !(*.dat) /data/archives/2005

Or

$ GLOBIGNORE='*.dat'  # tell bash to ignore *.dat
$ mv /data/product/* /data/archives/2005
$ unset GLOBIGNORE    # revert to normal behavior

-Chris

-- 
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]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux