<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to delete large number of files in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943702#M102968</link>
    <description>Shalom Raynald,&lt;BR /&gt;&lt;BR /&gt;To sum it up, you need a plan that does not leave you 1 million or even 100,000 files in the same directory.&lt;BR /&gt;&lt;BR /&gt;Thats what subdirectories are for.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
    <pubDate>Wed, 30 Nov 2005 13:23:49 GMT</pubDate>
    <dc:creator>Steven E. Protter</dc:creator>
    <dc:date>2005-11-30T13:23:49Z</dc:date>
    <item>
      <title>How to delete large number of files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943697#M102963</link>
      <description>Good day all,&lt;BR /&gt;&lt;BR /&gt;We have a directory that holds around 1 million files.  What is the fastest way to delete all those files short of rebuilding the filesystem the directory is housed in.&lt;BR /&gt;&lt;BR /&gt;I used &lt;BR /&gt;"find . -type f -print | xargs /bin/rm" &lt;BR /&gt;and it took 20 hours (on a D380).&lt;BR /&gt;&lt;BR /&gt;There must be a faster way...&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Rayb</description>
      <pubDate>Wed, 30 Nov 2005 12:29:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943697#M102963</guid>
      <dc:creator>Raynald Boucher</dc:creator>
      <dc:date>2005-11-30T12:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete large number of files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943698#M102964</link>
      <description>Hi Rayb,&lt;BR /&gt;&lt;BR /&gt;Well....the quickest way IS going to be destroying/rebuilding the LV.&lt;BR /&gt;The problem is the dir size. With 1 million files *every* lookup and inode mod is going to take a long time - especially on a K-class.&lt;BR /&gt;Do you *really* need that many files in a single dir?&lt;BR /&gt;If you do then I'd suggest that the dir be an FS &amp;amp; LV unto itself. Then you can knock it down &amp;amp; rebuild it w/o touching anything else.&lt;BR /&gt;&lt;BR /&gt;My 2 cents,&lt;BR /&gt;Jeff</description>
      <pubDate>Wed, 30 Nov 2005 12:34:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943698#M102964</guid>
      <dc:creator>Jeff Schussele</dc:creator>
      <dc:date>2005-11-30T12:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete large number of files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943699#M102965</link>
      <description>If I wanted to delete all files in a directory, I think I would&lt;BR /&gt;rm -R &lt;DIRECTORY name=""&gt;&lt;BR /&gt;mkdir &lt;DIRECTORY name=""&gt;&lt;BR /&gt;adjust owner/group/permissions as required. &lt;BR /&gt;&lt;BR /&gt;Not sure if this would be faster.&lt;/DIRECTORY&gt;&lt;/DIRECTORY&gt;</description>
      <pubDate>Wed, 30 Nov 2005 12:34:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943699#M102965</guid>
      <dc:creator>S.Rider</dc:creator>
      <dc:date>2005-11-30T12:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete large number of files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943700#M102966</link>
      <description>Hi Rayb:&lt;BR /&gt;&lt;BR /&gt;Well, as you said, the fastest way is to rebuild the filesystem.&lt;BR /&gt;&lt;BR /&gt;Consider: If you are deleting the vast majority of files, it may be faster to backup what you want to keep; rebuild the filesystem; and reload what you kept.&lt;BR /&gt;&lt;BR /&gt;If you can specify whole subdirectories in the filesystem, I'd certainly use:&lt;BR /&gt;&lt;BR /&gt;# rm -rf /mountpoint/dir1 /mountpoint/dir2 ...&lt;BR /&gt;&lt;BR /&gt;If you need some subdirectories retained, but not others, use a combination of the recursive 'rm' above and a 'find -type f' *limited* to those subdirectories where you want to remove only the files.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 30 Nov 2005 12:38:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943700#M102966</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-11-30T12:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete large number of files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943701#M102967</link>
      <description>You've already answered your own question. Rebuild the filesystem. Now go find a hammer and hit yourself over the head. 10^6 files in a directory is (stupid,dumb) less than optimal.&lt;BR /&gt;&lt;BR /&gt;We might be able to rearrange the question so that the time required doesn't matter very much:&lt;BR /&gt;&lt;BR /&gt;1) rename the existing directory&lt;BR /&gt;2) create a new directory with the name of the old&lt;BR /&gt;3) start your rm process on the renamed directory in the background - nohup'ed.&lt;BR /&gt;&lt;BR /&gt;The idea is that you have a fresh new directory available for use while the old one is being cleaned up and the cleanup time is not nearly so critical.&lt;BR /&gt;&lt;BR /&gt;Still, Plan A should be divide and conquer so that you never have that many files in a directory. In general, filesystems are poor substitutes for databases.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 30 Nov 2005 12:52:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943701#M102967</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-11-30T12:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete large number of files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943702#M102968</link>
      <description>Shalom Raynald,&lt;BR /&gt;&lt;BR /&gt;To sum it up, you need a plan that does not leave you 1 million or even 100,000 files in the same directory.&lt;BR /&gt;&lt;BR /&gt;Thats what subdirectories are for.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 30 Nov 2005 13:23:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943702#M102968</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-11-30T13:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete large number of files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943703#M102969</link>
      <description>Thanks for your answers.&lt;BR /&gt;I fully agree that it's too big but it's a legacy and I, personally,  can't do much about it at this moment.&lt;BR /&gt;One good thing, this directory is the only thing on that file system.&lt;BR /&gt;&lt;BR /&gt;Does anyone know of a faster way to back it up/ restore it than using "ftio"?&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Wed, 07 Dec 2005 09:53:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943703#M102969</guid>
      <dc:creator>Raynald Boucher</dc:creator>
      <dc:date>2005-12-07T09:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete large number of files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943704#M102970</link>
      <description>Unless you look at a commercial backup product like Data Protector, fbackup is probably your best bet. Configure it with multiple reader processe.</description>
      <pubDate>Wed, 07 Dec 2005 10:01:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943704#M102970</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-12-07T10:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete large number of files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943705#M102971</link>
      <description>We tried.  &lt;BR /&gt;It fails on an excessive file list.&lt;BR /&gt;That's why we use ftio.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Wed, 07 Dec 2005 10:12:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943705#M102971</guid>
      <dc:creator>Raynald Boucher</dc:creator>
      <dc:date>2005-12-07T10:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete large number of files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943706#M102972</link>
      <description>Thanks all</description>
      <pubDate>Wed, 07 Dec 2005 10:13:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-delete-large-number-of-files/m-p/4943706#M102972</guid>
      <dc:creator>Raynald Boucher</dc:creator>
      <dc:date>2005-12-07T10:13:50Z</dc:date>
    </item>
  </channel>
</rss>

