LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-27-2008, 06:11 PM   #1
unittester
LQ Newbie
 
Registered: Nov 2008
Posts: 1

Rep: Reputation: 0
Question how to quickly remove millions of files?


hi
i need to remove the directory with millions of small files (less then 100k each). my filesystem is ext3. when i run "rm -vfd mydir" i have got "rm: cannot remove `mydir': Is a directory".
"rm -rvf mydir" works, but it works very-very slow. in fact i need some weeks to remove files recursively. is there another way to unlink all this files?
 
Old 11-27-2008, 06:36 PM   #2
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,056

Rep: Reputation: 94
not that I know of. but try leaving out the v and just do a
Code:
rm -fr
maybe the verbose output is slowing things down.
 
Old 11-27-2008, 06:52 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,356

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Maybe check the mount attributes - noatime and nodiratime (can be set by remount).
Check out this thread - shouldn't take too long for the delete.
 
Old 11-27-2008, 06:54 PM   #4
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I guess these aren't on a partition by themselves are they (or with something else that could be easily copied off)? Then you could just reformat.
 
Old 11-27-2008, 10:08 PM   #5
salter
Member
 
Registered: Oct 2008
Posts: 100

Rep: Reputation: 15
Actually 'rm -rf' will not care about non-empty directories.

Having millions of files might already have fragmented your disk to an unbearable amount, maybe you already notice slow performance on that disk. You can also try 'smartctl' to find out how healthy your hard disk is.

If the drive does not contain system files, and you know what data you want to keep, then copy the needed data to a safe place and reformat the partition.

Last edited by Tinkster; 10-30-2010 at 05:12 PM.
 
Old 11-27-2008, 10:27 PM   #6
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,056

Rep: Reputation: 94
Quote:
Originally Posted by salter View Post
Actually 'rm -rf' will not care about non-empty directories.

Having millions of files might already have fragmented your disk to an unbearable amount, maybe you already notice slow performance on that disk. You can also try 'smartctl' to find out how healthy your hard disk is.

If the drive does not contain system files, and you know what data you want to keep, then copy the needed data to a safe place and reformat the partition.
Depending on what the disk was formated in it will not suffer from fragmentation due to how ext2 and 3 and all other filesystems attempt to store its files. Here is a good explanation. Not saying it can't be just that it is highly unlikely. http://geekblog.oneandoneis2.org/ind..._defragmenting
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
what is the command to delete files and folders quickly. ravi Linux - General 1 03-13-2007 12:09 PM
Evolution open iCal/vCal files quickly tmillard Linux - Software 0 02-03-2007 08:44 PM
How to print big files quickly husrah Linux - Newbie 4 08-30-2006 09:37 AM
deleting millions of files at once Red Squirrel Linux - Software 6 05-15-2005 03:59 PM
Completely Deleting Files (quickly) atheist Linux - General 9 05-04-2005 10:31 PM


All times are GMT -5. The time now is 09:04 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration