Here's a cheek-clencher...
find /home -iname \\\~\* -print0 | xargs -0 /bin/rm -rf
What do you think it should do, and how many times did I get it wrong in
testing.....
And that's in production use. Nightly from cron no less.
Douglas Royds wrote, On 10/07/09 12:49:
Just discovered the -delete option to "find". It's a little scary. Make
sure you put the -delete at the very end:
$ mkdir -p temp/one/two/three
$ find temp/ -type d -empty
temp/one/two/three
$ find temp/ -type d -empty -delete
$ find temp/ -type d -empty
find: `temp': No such file or directory
I think I still prefer the xargs approach, using rmdir:
$ find temp/ -type d -empty -print0 | xargs -0 rmdir -p
--
Craig Falconer