This was a quick and dirty modification of Michael Kerrisk's nftw_dir_tree.c from his examples. I needed something that could walk through a directory with probably several million files, and delete them. Other utilities that I tried (rm -rf, find ...) were using several gigabytes of memory, which I didn't like (nor the server that was trying to delete them).
Things to do:
Clean it up (remove commented out stuff, add Makefile).- Add options for verbosity.
- Add option for quiet mode.
- Integrate some ionice functionality to make it run with idle priority.
- Maybe let it fork off and run in the background (usually the time you'll need this, you don't want to sit around for hours watching it).
- Make this my own, Michael Kerrisk might have taught me how to do this, but it has strayed a long ways from his example.
- Have it log somewhere - verbose or just total files deleted.
- Remove directories as well as files.
- Maybe this will save me some time so I can go on a date... (maybe)