PDA

View Full Version : Best, fastest least resources intensive way to empty folder



Fli
08-25-2013, 10:35 AM
What is the best, least server intensive way to delete files / folders from some folder?

I have been told that it is by using find command:

delete all files in directory (empty directory)


find /home/username/tmp/analog/ -type f -delete

delete everything including folders from some directory


find /home/username/tmp/analog/ -delete

delete only folders from some directory


find /home/username/tmp/analog/* -type d -delete
(there it asks to delete this whole directory, unless you add asterisk on the end)