Removes directories which are less than 1028KB total. This works for systems where blank directories are 4KB. If a directory contains 1 MB (1024KB) or less, it will remove the directory using a path relative to the directory where the command was initially executed (safer than some other options I found).
Adjust the 1028 value for your needs.
It would be helpful to test the results before proceeding with the removal. Simply run all but the last two commands to see a list of what will be removed:
du | awk '{if($1<1028)print;}' | cut -d $'\t' -f 2-
If you're unsure what size a blank folder is, test it like this:
mkdir test; du test; rmdir test
If you want to change it to find other ebook format change the find extension and the output extensions for whatever that is.
Returns a list, with attributes (think `ls -l`), in reverse chronological order. N is a single numeric parameter. Robust against unfriendly filenames and directory structures. Show Sample Output
simulation test to see which files would be deleted: find . -name "*.bak" -type f
Recursively compares files in directories DIR and OLD_FILES using dwdiff Word-by-word comparison with dwdiff results in words unique to NEW file versions in the DIR directory tree shown enclosed in [- SQUARE BRACKETS -] and words unique to OLD file versions in the OLD_FILES directory tree shown enclosed in {+ CURLY BRACES +} Note: does not detect files unique to the OLD_FILES directory tree. Show Sample Output
Corrected.
This will handle the case that the filename has spaces or other characters that need to be escaped.
sometimes if directories are too deep, chmod -R fails... in those cases, a find comes in most handy :)
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: