How do you clean up a Linux directory with a large size / number of files?

I have a directoy on linux which has several hundred thousand files and is about 100 Gb. I tried to clear the directory using 'rm -f *' and got the following error:

>rm -f *
-ksh: rm: /bin/rm: cannot execute [Argument list too long]

      

I am getting the same error when I try to find the find command. I can delete individual files and groups if I can get a small enough expression, but it can take days to clear them all. Does anyone know of any better ways to empty a large directory?

+3


source to share


1 answer


Try the following:

rm -R -f [your_directory_path]

      



Then just manually re-create the directory, this way it's easier I believe than what you are trying to do:

mkdir [old_directory_name]

      

+3


source







All Articles