Wednesday, March 5, 2008

Too many files


If you get "Too many files..." message as some command's answer you can use find's --exec parameter, or the xargs command:

For example:
to delete specific files (*.log) from one directory


find /sample/directory -name '*.log' -exec rm {} \;

, or to scp them:

find /sample/directory/ -name *.log | xargs --max-args=1 -I '{}' scp '{}' someuser@somehost:somedest