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


Click here to return to the 'Use an 'rmdir' function that's smart about .DS_Store files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use an 'rmdir' function that's smart about .DS_Store files
Authored by: luomat on Dec 22, '09 10:28:23AM

Yes, I'm aware it's not "secure". However, for the vast, vast majority of Mac users, this will simply never be an issue because they are the only person using the computer.

> Alternately, just use `rm -rf` to delete directories rather than rmdir.

Sure, if you want to completely ignore the fact that the main benefit of 'rmdir' is that it will protect you from accidentally deleting a directory which isn't empty.



[ Reply to This | # ]
Use an 'rmdir' function that's smart about .DS_Store files
Authored by: dsouth on Dec 22, '09 11:23:15AM

Wasn't meant as a negative critique -- you wrote the script well. A one-line change to use mktemp rather than hard-coding the tmpfile path fixes the issue for MacOS users that frequent computer labs, have siblings, and are otherwise in shared environments.

Using mktemp also makes the script re-entrant so that more than one instance could be running at the same time without stepping on each other (important if you're doing scripted cleanups).



[ Reply to This | # ]