|
|
Script to delete huge sparsebundle images
I'm not sure what the problem with
rm -rf /path/to/folder/ could have been, I've never had a problem with recursively removing large directories. rm -rf /path/to/folder/*? Sure, there's a limit to how many arguments can be passed on the command line. But, that's where xargs comes in.For example: That's it. The -print0 separates the found items with a null character so you don't have to worry about escaping characters. xargs -0 recognizes the null separation and passes the listed arguments to whatever command follows next. Plus, xargs is smart enough to not send more arguments than is allowed to the command to be executed.But, there's an even easier option: The -print is optional, but allows you to see the files as they are deleted. I'm sure it would delete faster if you omit the printing.Add a sudo as required. Note, that the first example uses a pipe, so you'd need to use sudo before the xargs command as well. And of course, remember that you're deleting files here, be careful. ---
i am jack's amusing sig file
Script to delete huge sparsebundle images
You can simplify
Edited on Jul 19, '12 10:11:53AM by richard2
Script to delete huge sparsebundle images
Yeah, I've always preferred piping to xargs though. I think it's the requirement to use brackets to insert the arguments and the cryptic, required terminator '+' or ';'. --- i am jack's amusing sig file Edited on Jul 19, '12 10:18:50AM by fracai
Script to delete huge sparsebundle images
xargs is preferable as it would result in vastly fewer invocations of Command.
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.05 seconds |
|