Bash Script to move Files

Dave Mitchell davem at iabyn.com
Mon Oct 10 10:00:44 UTC 2005


On Mon, Oct 10, 2005 at 12:37:11PM +0800, Ow Mun Heng wrote:
> On Mon, 2005-10-10 at 12:33 +0800, Ow Mun Heng wrote:
> > On Fri, 2005-10-07 at 23:02 -0700, Gordon Messmer wrote:
> > > 
> > > The name of the file that matches the contstraints you described to 
> > > "find" is substituted for the {} after -exec.  Since mv expects the 
> > > source before the destination, you'd need to use "mv {} /destination"
> > 
> > or use xargs -i
> 
> Actually, that's wrong. just use xargs.
> 
> $ find . -iname "*.tmp" -maxdepth 1 -type f | xargs mv '{}' /location

That's completely wrong:

$ mkdir x
$ touch x/a x/b x/c
$ find x | xargs echo mv '{}' /location
mv {} /location x x/a x/b x/c
$

-- 
print+qq&$}$"$/$s$,$*${d}$g$s$@$.$q$,$:$.$q$^$,$@$*$~$;$.$q$m&if+map{m,^\d{0\,},,${$::{$'}}=chr($"+=$&||1)}q&10m22,42}6:17*2~2.3 at 3;^2dg3q/s"&=~m*\d\*.*g




More information about the fedora-list mailing list