in reply to Re^7: UNIX command - remove 0 byte file
in thread UNIX command - remove 0 byte file

xargs was used to eliminate the need to start a different process for each file to be removed. The use of xargs enables you to call rm with a list of file names. But rm will still have to delete the files one by one - the Unix unlink system call accepts only a single argument.

If you pipe the result of find into perl, you are calling a single process - only one perl instance will be fired. In fact, even less processes will be fired if there are many files to be deleted - xargs will start as many subprocesses as needed to avoid running into system limits with respect to argument lengths. But the perl solution doesn't have that problem, as it's reading the list from standard input, not from @ARGV.

  • Comment on Re^8: UNIX command - remove 0 byte file