I should also point out that my little untested script doesn't use /bin/rm, and it should. It will also fail on any files that can't be rm'ed due to to permissions or immutability settings. It also doesn't test the cd; if that fails you could be clearing out the wrong directory.
I would think find(1) piped through xargs(1) for rm(1) would be a better way of managing the deletions. No need to even use cd(1).
No bourne shell handy today for testing any of these ideas, though.
|