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


Click here to return to the 'Shell Script cleanup' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Shell Script cleanup
Authored by: lullabud on Jul 13, '05 06:27:46PM
I use /bin/sh! Seriously, I use something very similar to the following to keep my CVS server's repository clean of excess junk, including Apple, Windows, Paintshop Pro and ws_ftp crap. It requires root privs.
find /Volumes/PSP/ | grep -ir '\(\._\..*\|\.AppleDouble\|\.AppleDesktop\|ws_ftp\.log\|Thumbs\.db\|pspbrwse\.jbf\)$' \
| sed 's/^\(.*\)$/rm -f "\1"/' | /bin/sh
*Note: I'm no bash überguru, so this might not be the most effective way to get it done, but I do use that grep, sed and sh string on a production Debian server at work. I did test the non-linux command modification to see if it would delete anything crazy on my Powerbook and it didn't. To see what would have been deleted without actually deleting anything, just remove the "| /bin/sh" from the end of the command. It will then just print out a bunch of "rm -f" commands which don't actually do anything.

[ Reply to This | # ]