removing very large generated directories
Background:
I have a laptop I use while teaching for school/student records, loaded with Ubuntu 14.04. I would connect to the school wifi and on occasion load files from my students from thumb drives or Google drive.
I was trying to do some cleanup after the school year, and found, in my Administrator home directory, three very large directories that appear to have been generated by some process, with names such as "yxOureA37B" or "9Ybz7I7nnV" and containing files which also appear to be generated.
The gui is unable to open these directories, because of the number of files in them.
When I tried to move them to trash, the gui likewise did not handle the process successfully.
I went to the terminal and am able to cd into the directories, but a ls will hang, and an rm -f will return a "too many arguments" message.
I was able to determine that an ls xx* (where "xx" = a combination of alphanumeric letters or the underscore) will give me a list of the files - all of which seem to have a filesize of 0. The directories, on the other hand, are listed as containing several Gb.
I found a rm -f xx* will work, so I wrote a script to generate the two-character prefixes and do a rm -f on them. To remove just one of the directories was a 20+ hour run of this script, even with a nice value of -15.
Questions:
a) This does not happen on my other boxes running 14.04 - any idea where these files came from? ClamTk does not find any known malware, but there may be something I've missed.
b) Does anyone have any other hacks for removing such a large number of files more quickly?
I suspect that rm is actually first building a list of the files to be deleted, possibly checking permissions on each one to ensure the user can delete them (even running it as sudo), then marking them to be deleted in the inodes, and saving the list so that if something fails in the process it can roll back the action. I really don't know that I want to short-circuit that. But I'd like something faster if anyone has a hack that will work. Taking 72 hours to remove three directories it bothersome.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Ubuntu Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- actionparsnip
- Solved:
- Last query:
- Last reply: