mv(move) command file/directory name we want to move and destination name.
Using mv command with xargs is bit tricky.
Here is the example to move all files from oldDir to newDir:
$ find oldDir -type f | xargs -n 1 -I '{}' mv {} newDir/
where,
-type f is to find only files
-n 1 is for one argument at a time, that will move one file at time.
{} is the default argument list marker. You need to use {} this with various command which take more than two arguments at a time.
The main advantage of using xargs is it’s faster and efficient.
-Sany
Reblogged this on therouters.