[clug] list only directories - mv with xargs

David Deaves David.Deaves at dd.id.au
Wed Nov 20 16:19:55 MST 2013


> 
> [I've another problem with using xargs and 'mv'. You have to work hard
> to put the new destination at the end of the line, after the args that
> xargs inserts. Or I should reread the man pages :)]

GNU  mv  has had a   -t Target_Dir   flag for a long time.

I still avoid using it in scripts so I don't get any nasty surprises when I 
run my script on a non GNU platform, but these days happily use it on the 
command line.

Once I went to the trouble of making  mv-t
-------------------------- cut -----------------------
#!/bin/sh

tgt="$1"
/bin/mv "$@" "$1"
-------------------------- cut -----------------------


But generally just settle for using  xargs  -I  and having 'mv' invoked per 
file.


Dave !



More information about the linux mailing list