Jan. 8th, 2008

airmax: (Default)
http://www.ducea.com/2006/05/24/binrm-annoying-limitation-argument-list-too-long/

The possible solutions are to either run the rm command inside a loop and delete each individual result, or to use find with the xargs parameter to pass the delete command. I prefer the find solution so I had changed the rm line inside the script to:

find /home/$u/tmp/ -name '*.wrk' -print0 | xargs -0 rm

this does the trick and solves the problem. One final touch was to not receive warnings if there were no actual files to delete, like:

rm: too few arguments
Try `rm --help' for more information.

For this I have added the -f parameter to rm (-f, --force = ignore nonexistent files, never prompt). Since this was running in a shell script from cron the prompt was not needed also so no problem here. The final line I used to replace the rm one was:

find /home/$u/tmp/ -name '*.wrk' -print0 | xargs -0 rm -f

thanks!

Profile

airmax: (Default)
airmax

April 2011

S M T W T F S
      12
345 6 7 89
10 11 12 131415 16
17181920212223
24252627282930

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 13th, 2025 11:47 am
Powered by Dreamwidth Studios