Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I have this folder with probably over 1 million small files, suprised it did not crash the filesystem due to the inode limit, but anyway, when I do a rm to delete them all, it errors out with -bash: /bin/rm: Argument list too long. Is there a quick way (other then formatting) to delete all these?
Distribution: At home: Arch, OpenBSD, Solaris. At work: CentOS, Debian, Ubuntu
Posts: 3,625
Rep:
Assuming you want the folder and all its files gone:
rm -rf /path/to/folder
The reason you get argument list to long is that the shell expands wildcards like *. You can delete a few files at a time with rm [a-c]* for all file beginning with a, b, or c, which may put you under the limit.
As always, with rm and wildcards, be very very careful. Linux does not have an undelete.
Thanks that for loop one worked. Never thought of doing that. Well would not have known how anyway. :P
Speaking of not being an undelete in linux, is there any utility you can get to restore files? or does deleting in linux actually destroy the file, unlike windows? Would be handy to have in case I ever goof up or something.
Last time I deleted something I should not (stupid console emulator from Konqueror!!!!) I found that in ext2 filesystems files can be restored, but in ext3 isn't possible because......well, bacause something i don't remember
Originally posted by RedDwarf Last time I deleted something I should not (stupid console emulator from Konqueror!!!!) I found that in ext2 filesystems files can be restored, but in ext3 isn't possible because......well, bacause something i don't remember
Yeah I figured, because of the journaling, it overrites quickly. Which sucks since beleive it or not I just just pulled it off on a folder while doing a cleanup. Typed the wrong folder name. Good thing it's stuff I can get back though. I was wondering why it was taking so long then suddently relized I typed the wrong folder. I must of hit CTRL+C at least 20 times.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.