[ilugd] Fwd: Delete thousands of folders and files

2008-04-07 Thread Tanveer Singh
On Mon, Apr 7, 2008 at 2:21 PM, Anupam Jain [EMAIL PROTECTED] wrote:
 
  On Mon, Apr 7, 2008 at 1:57 PM, Tanveer Singh [EMAIL PROTECTED] wrote:
I have a directory called somedir
 Inside this directory there are thousands of subdirectories(20,000+)
 and even more number of small files(100,000+)
 If I do a \rm -rf somedir, it takes hours.
 Is there a way to quickly delete this directory.
 Currently I use Konqueror and it does the job more quickly, but still
 its pretty slow.
 
   1) You can run the process in the background so that you can still do
   other work.
   OR
   2) use the --directory option which will unlink the directory even if
   it's non empty. But in this case the system will recursively unlink
   all the files the next time you run fsck and you'll have to wait a
   long time then.
 
   Basically if you want to do something NOW which expects the directory
   to not be there, go with option 2. Else stick to the usual option 1.
 
   -- Anupam
 Currently I do this
 mv somedir somedir.old
 find somedir.old -name * -exec rm -rf {} \;
 I was hoping for some quick delete kind of stuff.

___
ilugd mailinglist -- ilugd@lists.linux-delhi.org
http://frodo.hserus.net/mailman/listinfo/ilugd
Next Event: http://freed.in - February 22-24, 2008
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
http://www.mail-archive.com/ilugd@lists.linux-delhi.org/


Re: [ilugd] Fwd: Delete thousands of folders and files

2008-04-07 Thread Anupam Jain
On Mon, Apr 7, 2008 at 2:27 PM, Tanveer Singh [EMAIL PROTECTED] wrote:

 On Mon, Apr 7, 2008 at 2:21 PM, Anupam Jain [EMAIL PROTECTED] wrote:
   
On Mon, Apr 7, 2008 at 1:57 PM, Tanveer Singh [EMAIL PROTECTED] wrote:
  I have a directory called somedir
   Inside this directory there are thousands of subdirectories(20,000+)
   and even more number of small files(100,000+)
   If I do a \rm -rf somedir, it takes hours.
   Is there a way to quickly delete this directory.
   Currently I use Konqueror and it does the job more quickly, but still
   its pretty slow.
   
 1) You can run the process in the background so that you can still do
 other work.
 OR
 2) use the --directory option which will unlink the directory even if
 it's non empty. But in this case the system will recursively unlink
 all the files the next time you run fsck and you'll have to wait a
 long time then.
   
 Basically if you want to do something NOW which expects the directory
 to not be there, go with option 2. Else stick to the usual option 1.
   
 -- Anupam
   Currently I do this
   mv somedir somedir.old
   find somedir.old -name * -exec rm -rf {} \;
   I was hoping for some quick delete kind of stuff.

Hmm well that statement will take a lot longer than an rm -rf! But the
mv idea is a good one if all you want is to make the directory
invisible to some process that expects it to be named a certain way.
Just rename the directory to a different name for a quick 'delete' and
then do an rm -rf when you have more time..

-- Anupam

___
ilugd mailinglist -- ilugd@lists.linux-delhi.org
http://frodo.hserus.net/mailman/listinfo/ilugd
Next Event: http://freed.in - February 22-24, 2008
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
http://www.mail-archive.com/ilugd@lists.linux-delhi.org/


Re: [ilugd] Fwd: Delete thousands of folders and files

2008-04-07 Thread justintmoore22
If you pipe your find output to xargs it will run a lot faster : find 
somedir ¦ xargs rm -rf should make quick work of the files.

Justin

On Mon, 7 Apr 2008 4:57 am, Tanveer Singh wrote:
 On Mon, Apr 7, 2008 at 2:21 PM, Anupam Jain [EMAIL PROTECTED] wrote:
  
   On Mon, Apr 7, 2008 at 1:57 PM, Tanveer Singh [EMAIL PROTECTED] 
 wrote:
 I have a directory called somedir
  Inside this directory there are thousands of 
 subdirectories(20,000+)
  and even more number of small files(100,000+)
  If I do a \rm -rf somedir, it takes hours.
  Is there a way to quickly delete this directory.
  Currently I use Konqueror and it does the job more quickly, but 
 still
  its pretty slow.
  
1) You can run the process in the background so that you can still 
 do
other work.
OR
2) use the --directory option which will unlink the directory even 
 if
it's non empty. But in this case the system will recursively unlink
all the files the next time you run fsck and you'll have to wait a
long time then.
  
Basically if you want to do something NOW which expects the 
 directory
to not be there, go with option 2. Else stick to the usual option 
 1.
  
-- Anupam
  Currently I do this
  mv somedir somedir.old
  find somedir.old -name * -exec rm -rf {} \;
  I was hoping for some quick delete kind of stuff.

 ___
 ilugd mailinglist -- ilugd@lists.linux-delhi.org
 http://frodo.hserus.net/mailman/listinfo/ilugd
 Next Event: http://freed.in - February 22-24, 2008
 Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
 http://www.mail-archive.com/ilugd@lists.linux-delhi.org/
___
ilugd mailinglist -- ilugd@lists.linux-delhi.org
http://frodo.hserus.net/mailman/listinfo/ilugd
Next Event: http://freed.in - February 22-24, 2008
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
http://www.mail-archive.com/ilugd@lists.linux-delhi.org/


Re: [ilugd] Fwd: Delete thousands of folders and files

2008-04-07 Thread Karanbir Singh
Tanveer Singh wrote:
  Currently I do this
  mv somedir somedir.old
  find somedir.old -name * -exec rm -rf {} \;
  I was hoping for some quick delete kind of stuff.

What filesystem is this on ? if its ext3 you can change your drive cache 
policy, disable index's, disable time updates  etc ( there must be a few 
dozen tweaks that most distro's put in with new ext3's that could slow 
you down a bit )..

Also, you might want to think about what you doing here... the find 
somedir with hit a directory and never return till everything under 
there is done. so perhaps start with a director really deep and work 
your way up, if you dont want to hit i/o on the machine too hard

-- 
Karanbir Singh : http://www.karan.org/  : [EMAIL PROTECTED]

___
ilugd mailinglist -- ilugd@lists.linux-delhi.org
http://frodo.hserus.net/mailman/listinfo/ilugd
Next Event: http://freed.in - February 22-24, 2008
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
http://www.mail-archive.com/ilugd@lists.linux-delhi.org/