Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Script to delete huge sparsebundle images' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Script to delete huge sparsebundle images
Authored by: Mechcozmo on Jul 19, '12 09:16:00AM
This is a pretty common issue, and a very frustrating one because the error isn't clear. Wildcards in the command line expand, which if you have 250,000 files in a directory means you are sending:
rm file1 file2 file3 ... file250000
That's where you get too many arguments from. (It's also technically a kernel-level error, not a bug with rm; see link below) However, you don't need an AppleScript, and in some cases you may not have AppleScript available (*NIX machines, for example). As explained here, you can use the find command in order to generate a list and then run the rm command on each result that is found, instead of running rm with every result. This command will delete all files in the current directory:
find . -name '*' | xargs rm

[ Reply to This | # ]