ls -lrt |grep 'Jun 30th' | awk '{print $9}' | xargs mv -t /destinationFolderI'm trying to move files from certain date or pattern or createuser. It doesn't work properly without the -t option. Could someone please enlighten on xargs -n and -t in move command?
What does '-t' do in mv command? Example below
pipe;ls;xargs;mv;filter
From the mv man page   -t, --target-directory=DIRECTORY          move all SOURCE arguments into DIRECTORYmv's default behavior is to move everything into the last argument so when xargs executes the command it does it like     mv /destinationFolder pipedArgs without the -t it would try to move everything into the last arg piped to xargs. With the -t you're explicitly saying to move it HERE.From the xargs man page  -n max-args      Use at most max-args arguments per command line.  Fewer than max-args arguments will be used if the size (see the -s option) is exceeded, unless the -x option is given, in which case xargs will exit.Normally xargs will pass all the args at once to the command. For exampleecho 1 2 3 4 |xargs echo1 2 3 4executesecho 1 2 3 4Whileecho 1 2 3 4 |xargs -n 1 echoexecutesecho 1echo 2echo 3echo 4