We have an issue with a folder becoming unwieldy with hundreds of thousands of tiny files.
There are so many files that performing rm -rf returns an error and instead what we need to do is something like:
find /path/to/folder -name "filenamestart*" -type f -exec rm -f{} \;
This works but is very slow and constantly fails from running out of memory.
Is there a better way to do this? Ideally I would like to remove the entire directory without caring about the contents inside it.
rm -rf *in the folder probably fails because of too many arguments; but what aboutrm -rf folder/if you want to remove the entire directory anyways? – sr_ Apr 26 '12 at 8:01rm -rf? – jw013 Apr 26 '12 at 11:37fsckon it to reclaim the unused disk blocks, but that approach seems risky and may not be any faster. In addition, the file system check might involve recursively traversing the file system tree anyways. – jw013 Apr 26 '12 at 13:27