Quickly delete a directory containing many files
April 16, 2007 2:07 PM
Subscribe
In a Unix-type system, is there a way to quickly remove a directory that contains lots and lots of files?
So I ran a job overnight and was kind of careless when I programmed it. When I went to the directory where I was writing my log files and typed 'ls', the system basically sat there. Then I realized that I had written a separate log file for each trial, and I ran a lot of trials... I'm not sure how many files are in that folder but it could easily be a million. oops!
It's been spinning for an hour so far. It isn't accepting new connections - it stalls in the password check of ssh - so I can't kill the job. Once it finally finishes 'ls'ing, I want to remove that folder so I don't forget and 'ls' it again. If I 'rm -rf' it I expect it will have to page through the files and that could take just as long. What if I just change the name of the folder, will that be quick? Any other options?
posted by PercussivePaul to computers & internet (18 comments total)
3 users marked this as a favorite
posted by chrismear at 2:12 PM on April 16, 2007