<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: How to Delete All Files in a Folder Except Certain Extensions	</title>
	<atom:link href="https://www.tecmint.com/delete-files-except-certain-file-extensions/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.tecmint.com/delete-files-except-certain-file-extensions/</link>
	<description>Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks.</description>
	<lastBuildDate>Mon, 14 Apr 2025 05:30:25 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>
		By: Yasen		</title>
		<link>https://www.tecmint.com/delete-files-except-certain-file-extensions/comment-page-1/#comment-1708572</link>

		<dc:creator><![CDATA[Yasen]]></dc:creator>
		<pubDate>Wed, 26 Jan 2022 15:38:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.tecmint.com/?p=23183#comment-1708572</guid>

					<description><![CDATA[For me, the working method was &quot;Delete Files Using Bash GLOBIGNORE Variable&quot;.

My goal was to leave only some video and audio files, independent of lower/uppercase:

&lt;code&gt;GLOBIGNORE=*.[Mm][Pp][34]:*.[Mm]4[Aa]:*.[Ww][Aa][Vv]:*.3[Gg][Pp]:*.[Mm][Oo][Vv]:*.[Oo][Gg][Gg]:*.[Oo][Pp][Uu][Ss]:*.[Aa][Aa][Cc]
rm -v *
unset GLOBIGNORE&lt;/code&gt;

Hope this will help...]]></description>
			<content:encoded><![CDATA[<p>For me, the working method was &#8220;Delete Files Using Bash GLOBIGNORE Variable&#8221;.</p>
<p>My goal was to leave only some video and audio files, independent of lower/uppercase:</p>
<p><code>GLOBIGNORE=*.[Mm][Pp][34]:*.[Mm]4[Aa]:*.[Ww][Aa][Vv]:*.3[Gg][Pp]:*.[Mm][Oo][Vv]:*.[Oo][Gg][Gg]:*.[Oo][Pp][Uu][Ss]:*.[Aa][Aa][Cc]<br />
rm -v *<br />
unset GLOBIGNORE</code></p>
<p>Hope this will help&#8230;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Kyle James		</title>
		<link>https://www.tecmint.com/delete-files-except-certain-file-extensions/comment-page-1/#comment-1679182</link>

		<dc:creator><![CDATA[Kyle James]]></dc:creator>
		<pubDate>Thu, 16 Dec 2021 09:05:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.tecmint.com/?p=23183#comment-1679182</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.tecmint.com/delete-files-except-certain-file-extensions/comment-page-1/#comment-1246758&quot;&gt;Aaron Kili&lt;/a&gt;.

A directory is a file, your understanding of Linux and your guide are both jokes. If you can&#039;t make a guide clear then you either don&#039;t understand what you are talking about or you are bad at explaining things. Next time, don&#039;t try what you are not willing to do properly and learn before you teach. Thank you.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a target="_blank" href="https://www.tecmint.com/delete-files-except-certain-file-extensions/comment-page-1/#comment-1246758">Aaron Kili</a>.</p>
<p>A directory is a file, your understanding of Linux and your guide are both jokes. If you can&#8217;t make a guide clear then you either don&#8217;t understand what you are talking about or you are bad at explaining things. Next time, don&#8217;t try what you are not willing to do properly and learn before you teach. Thank you.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: sac		</title>
		<link>https://www.tecmint.com/delete-files-except-certain-file-extensions/comment-page-1/#comment-1332300</link>

		<dc:creator><![CDATA[sac]]></dc:creator>
		<pubDate>Fri, 08 May 2020 05:33:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.tecmint.com/?p=23183#comment-1332300</guid>

					<description><![CDATA[Hi,

I am trying to delete files from multiple directories through a shell script, in few directory files will come with an extension &lt;code&gt;(.csv)&lt;/code&gt; and for few just an alphanumeric names.

Now the problem is, for the files with the extension I am using below line of command and which is working as expected.
&lt;pre&gt;
# find /Collected_Directory/A/ -type f -name &#039;*.csv&#039; -delete;
&lt;/pre&gt;
but for the directory having files without extension I am using the &lt;strong&gt;&quot;rm&quot;&lt;/strong&gt; command as below which asks permission to delete each file.
&lt;pre&gt;
# rm /Collected_Directory/B/*
&lt;/pre&gt;
&lt;strong&gt;Note&lt;/strong&gt;:
&lt;ol&gt;
&lt;li&gt;I can&#039;t change the directory permission.&lt;/li&gt;
&lt;li&gt;I don&#039;t want to delete any subdirectories as well.&lt;/li&gt;
&lt;/ol&gt;]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>I am trying to delete files from multiple directories through a shell script, in few directory files will come with an extension <code>(.csv)</code> and for few just an alphanumeric names.</p>
<p>Now the problem is, for the files with the extension I am using below line of command and which is working as expected.</p>
<pre>
# find /Collected_Directory/A/ -type f -name '*.csv' -delete;
</pre>
<p>but for the directory having files without extension I am using the <strong>&#8220;rm&#8221;</strong> command as below which asks permission to delete each file.</p>
<pre>
# rm /Collected_Directory/B/*
</pre>
<p><strong>Note</strong>:</p>
<ol>
<li>I can&#8217;t change the directory permission.</li>
<li>I don&#8217;t want to delete any subdirectories as well.</li>
</ol>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: AvidWarning		</title>
		<link>https://www.tecmint.com/delete-files-except-certain-file-extensions/comment-page-1/#comment-1316216</link>

		<dc:creator><![CDATA[AvidWarning]]></dc:creator>
		<pubDate>Wed, 12 Feb 2020 06:50:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.tecmint.com/?p=23183#comment-1316216</guid>

					<description><![CDATA[There are typos in topics 6 and 7. Some extensions don&#039;t have &lt;code&gt;*.&lt;/code&gt;.

That&#039;s dangerous!

Cheers.]]></description>
			<content:encoded><![CDATA[<p>There are typos in topics 6 and 7. Some extensions don&#8217;t have <code>*.</code>.</p>
<p>That&#8217;s dangerous!</p>
<p>Cheers.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Aaron Kili		</title>
		<link>https://www.tecmint.com/delete-files-except-certain-file-extensions/comment-page-1/#comment-1246758</link>

		<dc:creator><![CDATA[Aaron Kili]]></dc:creator>
		<pubDate>Wed, 18 Sep 2019 07:26:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.tecmint.com/?p=23183#comment-1246758</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.tecmint.com/delete-files-except-certain-file-extensions/comment-page-1/#comment-1245602&quot;&gt;mekkanizer&lt;/a&gt;.

@Mekkanizer

Oh sorry about losing your valuable files, but the heading/title is clear enough deleting of files with a particular extension. And the commands all show deleting of files e.g &lt;code&gt;$ rm -v !(&quot;filename&quot;)&lt;/code&gt; not directory name. Next time don&#039;t try what is out of the scope a guide expecting the same results.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a target="_blank" href="https://www.tecmint.com/delete-files-except-certain-file-extensions/comment-page-1/#comment-1245602">mekkanizer</a>.</p>
<p>@Mekkanizer</p>
<p>Oh sorry about losing your valuable files, but the heading/title is clear enough deleting of files with a particular extension. And the commands all show deleting of files e.g <code>$ rm -v !("filename")</code> not directory name. Next time don&#8217;t try what is out of the scope a guide expecting the same results.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
