<?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 rm files in all subdirs, in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/how-to-rm-files-in-all-subdirs/m-p/4576753#M60366</link>
    <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I also was looking how to extract just file name from the path, something like perl's split command.&lt;BR /&gt;&lt;BR /&gt;You have that as 'basename' [ and its complementary 'dirname' ]:&lt;BR /&gt;&lt;BR /&gt;# FILE=/usr/bin/perl&lt;BR /&gt;# echo $(basename $FILE)&lt;BR /&gt;perl&lt;BR /&gt;&lt;BR /&gt;...or if you prefer, use the shell's parameter substitution:&lt;BR /&gt;&lt;BR /&gt;# FILE=/usr/bin/perl&lt;BR /&gt;#  echo ${FILE##*/}&lt;BR /&gt;perl&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Wed, 03 Feb 2010 20:17:30 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2010-02-03T20:17:30Z</dc:date>
    <item>
      <title>how to rm files in all subdirs,</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-rm-files-in-all-subdirs/m-p/4576748#M60361</link>
      <description>Hi,&lt;BR /&gt;Is it possible to do with rm -r, I need to delete all .zip files in number of subdir.&lt;BR /&gt;Only files need to be deleted, subdirs should stay as is.&lt;BR /&gt;&lt;BR /&gt;Will be good if no need for any looping.&lt;BR /&gt;&lt;BR /&gt;Tx to all&lt;BR /&gt;D</description>
      <pubDate>Tue, 02 Feb 2010 23:19:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-rm-files-in-all-subdirs/m-p/4576748#M60361</guid>
      <dc:creator>JianW</dc:creator>
      <dc:date>2010-02-02T23:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to rm files in all subdirs,</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-rm-files-in-all-subdirs/m-p/4576749#M60362</link>
      <description>&lt;!--!*#--&gt;&amp;gt; [...] I need to delete all .zip files [...]&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Is it possible to do with rm -r, [...]&lt;BR /&gt;&lt;BR /&gt;I don't see how.  The usual tool for a task&lt;BR /&gt;like this would be "find".&lt;BR /&gt;&lt;BR /&gt;      man find&lt;BR /&gt;&lt;BR /&gt;Look for "-exec".&lt;BR /&gt;&lt;BR /&gt;Perhaps something like:&lt;BR /&gt;&lt;BR /&gt;find dir -name '*.zip' -exec ls {} \;&lt;BR /&gt;&lt;BR /&gt;If you like the list, then change "ls" to&lt;BR /&gt;"rm".</description>
      <pubDate>Wed, 03 Feb 2010 00:13:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-rm-files-in-all-subdirs/m-p/4576749#M60362</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2010-02-03T00:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to rm files in all subdirs,</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-rm-files-in-all-subdirs/m-p/4576750#M60363</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;As Steven noted, the manpages are your friend.  That said, you could do:&lt;BR /&gt;&lt;BR /&gt;# find /path -xdev -type f -name "*.zip -exec rm {} +&lt;BR /&gt;&lt;BR /&gt;The '-xdev' option prevents 'find()' from crossing mountpoints.  The '-type f' limits things to files (and not directories).  The '-name "*.zip"' looks for the files with the '.zip' extension.  You must quote the name so that the shell doesn't expand the "*" wildcard character.  The quotes allow the expression to be passed intact to 'find()'.&lt;BR /&gt;&lt;BR /&gt;The '-exec rm {} +' says to bundle up multiple arguments and pass them to 'rm'.  This is very efficient.  If you use the '-exec rm {} \;' form then a 'rm' process is spawned for *every* file that needs to be removed.  This can really warm your processor :-)&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 03 Feb 2010 14:27:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-rm-files-in-all-subdirs/m-p/4576750#M60363</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-02-03T14:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to rm files in all subdirs,</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-rm-files-in-all-subdirs/m-p/4576751#M60364</link>
      <description>&lt;!--!*#--&gt;&amp;gt; # find /path -xdev -type f -name "*.zip -exec rm {} +&lt;BR /&gt;&lt;BR /&gt;Missed a quotation mark (after "*.zip)?&lt;BR /&gt;&lt;BR /&gt;&amp;gt; [...] The '-type f' limits things to files&lt;BR /&gt;&amp;gt; (and not directories). [...]&lt;BR /&gt;&lt;BR /&gt;Although, if you're foolish enough to have a&lt;BR /&gt;directory named "*.zip", it might be useful&lt;BR /&gt;to get a nice error message back from "rm".</description>
      <pubDate>Wed, 03 Feb 2010 15:07:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-rm-files-in-all-subdirs/m-p/4576751#M60364</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2010-02-03T15:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to rm files in all subdirs,</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-rm-files-in-all-subdirs/m-p/4576752#M60365</link>
      <description>Thanks all, Steven, James and one more time Steven.&lt;BR /&gt;&lt;BR /&gt;It's simple now, I"m new in unix, so it bit hard to get used all this ksh, for me it's look to compact ant too powerful. Already rm'ed some good stuff0).&lt;BR /&gt;&lt;BR /&gt;I also was looking how to extract just file name from the path, something like perl's split command.&lt;BR /&gt;&lt;BR /&gt;Tx again to all.&lt;BR /&gt;J</description>
      <pubDate>Wed, 03 Feb 2010 18:35:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-rm-files-in-all-subdirs/m-p/4576752#M60365</guid>
      <dc:creator>JianW</dc:creator>
      <dc:date>2010-02-03T18:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to rm files in all subdirs,</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-rm-files-in-all-subdirs/m-p/4576753#M60366</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I also was looking how to extract just file name from the path, something like perl's split command.&lt;BR /&gt;&lt;BR /&gt;You have that as 'basename' [ and its complementary 'dirname' ]:&lt;BR /&gt;&lt;BR /&gt;# FILE=/usr/bin/perl&lt;BR /&gt;# echo $(basename $FILE)&lt;BR /&gt;perl&lt;BR /&gt;&lt;BR /&gt;...or if you prefer, use the shell's parameter substitution:&lt;BR /&gt;&lt;BR /&gt;# FILE=/usr/bin/perl&lt;BR /&gt;#  echo ${FILE##*/}&lt;BR /&gt;perl&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 03 Feb 2010 20:17:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-rm-files-in-all-subdirs/m-p/4576753#M60366</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-02-03T20:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to rm files in all subdirs,</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-rm-files-in-all-subdirs/m-p/4576754#M60367</link>
      <description>&lt;!--!*#--&gt;&amp;gt; [...] Already rm'ed some good stuff [...]&lt;BR /&gt;&lt;BR /&gt;I started with "ls" instead of "rm" for a&lt;BR /&gt;reason.  Trust no one, especially yourself,&lt;BR /&gt;I always say.</description>
      <pubDate>Thu, 04 Feb 2010 04:27:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-rm-files-in-all-subdirs/m-p/4576754#M60367</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2010-02-04T04:27:00Z</dc:date>
    </item>
  </channel>
</rss>

