Saturday, August 29, 2009

find + xargs

http://www.kalamazoolinux.org/tech/find.html
http://en.wikipedia.org/wiki/Xargs
http://www.cyberciti.biz/faq/linux-unix-bsd-xargs-construct-argument-lists-utility/

For those commands don't support recursive option, you can use find + xargs, for example:

$ find | xargs touch
$ find /home/test/ | xargs -n 1 -I @ cp @ test.txt

This will touch all files in current dir.

[Note] use "xargs -n 1" will process one by one
[Note] use "-r" option to skip empty input (--no-run-if-empty)

No comments:

Related Posts Plugin for WordPress, Blogger...