03 February 2012

How to remove milions of files from one directory?

If you have a lots of files in one directory you can try the following to remove them:

- ls (but this will get a killed or out of memory message)
- rm * (after using up all your memory it will exit with an error like killed)
- find /path/to/folder -exec rm {} (will generate a lot of IO and will exit without removing the files)
... other ideas?

Anyway, you can remove those files (slowly) by using the NFS/Samba share. It will take a while (couple of days) but it's working. For some reasons Windows is able to see more than 9 million files (this is what we tested) in one directory, while linux can't...

No comments:

Post a Comment