<?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: Compress a Directory of Files into Individual Archives</title>
	<atom:link href="http://r3dux.org/2009/04/how-to-compress-a-directory-of-files-into-individual-archives/feed/" rel="self" type="application/rss+xml" />
	<link>http://r3dux.org/2009/04/how-to-compress-a-directory-of-files-into-individual-archives/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-compress-a-directory-of-files-into-individual-archives</link>
	<description>A number-pimping side project from the valleys in *NEW* upside-down flavour.</description>
	<lastBuildDate>Tue, 15 May 2012 23:01:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: Ray</title>
		<link>http://r3dux.org/2009/04/how-to-compress-a-directory-of-files-into-individual-archives/#comment-7702</link>
		<dc:creator>Ray</dc:creator>
		<pubDate>Thu, 26 Apr 2012 07:55:12 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=439#comment-7702</guid>
		<description>Thanks to shetboy, the one liner works very well for me to tar zip all files in a directory individual</description>
		<content:encoded><![CDATA[<p>Thanks to shetboy, the one liner works very well for me to tar zip all files in a directory individual</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: r3dux</title>
		<link>http://r3dux.org/2009/04/how-to-compress-a-directory-of-files-into-individual-archives/#comment-7649</link>
		<dc:creator>r3dux</dc:creator>
		<pubDate>Fri, 13 Apr 2012 06:30:49 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=439#comment-7649</guid>
		<description>Glad you like =D

To make it easily executable, why not stick it in a bash script, make the bash script executable and then sling it in /usr/local/bin.

Alternatively, Ctrl+R then typing the first part of the command (then hitting Ctrl+R again as many times as you like) allows you to search your bash command history, but I think a bash script is the better solution.

Cheers,
r3dux</description>
		<content:encoded><![CDATA[<p>Glad you like =D</p>
<p>To make it easily executable, why not stick it in a bash script, make the bash script executable and then sling it in /usr/local/bin.</p>
<p>Alternatively, Ctrl+R then typing the first part of the command (then hitting Ctrl+R again as many times as you like) allows you to search your bash command history, but I think a bash script is the better solution.</p>
<p>Cheers,<br />
r3dux</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Detron Phillips</title>
		<link>http://r3dux.org/2009/04/how-to-compress-a-directory-of-files-into-individual-archives/#comment-7648</link>
		<dc:creator>Detron Phillips</dc:creator>
		<pubDate>Thu, 12 Apr 2012 23:43:11 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=439#comment-7648</guid>
		<description>I love your   find . -type f -name &#039;*&#039; ! -name &#039;*.7z&#039; -execdir sh -c &#039;7z a -mx9 -mmt &quot;$1&quot;.7z &quot;$1&quot;&#039; : {} \;        command, but I have one question.

usually I add things like this to my bashrc file as an alias, but since it has single and double quotes, that is not an option.

how can I make this a bashrc function, or a stand alone program that i can call at any time?

thanks!</description>
		<content:encoded><![CDATA[<p>I love your   find . -type f -name &#8216;*&#8217; ! -name &#8216;*.7z&#8217; -execdir sh -c &#8217;7z a -mx9 -mmt &#8220;$1&#8243;.7z &#8220;$1&#8243;&#8216; : {} \;        command, but I have one question.</p>
<p>usually I add things like this to my bashrc file as an alias, but since it has single and double quotes, that is not an option.</p>
<p>how can I make this a bashrc function, or a stand alone program that i can call at any time?</p>
<p>thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pawel</title>
		<link>http://r3dux.org/2009/04/how-to-compress-a-directory-of-files-into-individual-archives/#comment-7462</link>
		<dc:creator>Pawel</dc:creator>
		<pubDate>Tue, 07 Feb 2012 09:22:52 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=439#comment-7462</guid>
		<description>Thanks a lot! This works like a charm. You knew it. :)
I am currently searching for more of you bash scripts. Since GUI is not very friendly for a screen reader under Linux I like to stay with the command line.
Best,
Pawel.</description>
		<content:encoded><![CDATA[<p>Thanks a lot! This works like a charm. You knew it. <img src='http://r3dux.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
I am currently searching for more of you bash scripts. Since GUI is not very friendly for a screen reader under Linux I like to stay with the command line.<br />
Best,<br />
Pawel.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: r3dux</title>
		<link>http://r3dux.org/2009/04/how-to-compress-a-directory-of-files-into-individual-archives/#comment-7459</link>
		<dc:creator>r3dux</dc:creator>
		<pubDate>Mon, 06 Feb 2012 03:00:37 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=439#comment-7459</guid>
		<description>Just place the destination path before the &lt;strong&gt;&quot;$1&quot;.7z&lt;/strong&gt; part like this:

&lt;pre lang=&quot;bash&quot;&gt;find . -maxdepth 1 -type d -name &#039;*&#039; ! -name &#039;.&#039; -execdir sh -c &#039;7z a -mx9 -mmt &lt;destination-path&gt;/&quot;$1&quot;.7z &quot;$1&quot;&#039; : {} \;&lt;/pre&gt;

For example, if I wanted to compress each directory into a 7z archive and have them placed in the folder &lt;strong&gt;~/backups&lt;/strong&gt; (where ~ gets substituted for the current users home directory, so for me would equate to &lt;strong&gt;/home/r3dux&lt;/strong&gt;), I could use:

&lt;pre lang=&quot;bash&quot;&gt;find . -maxdepth 1 -type d -name &#039;*&#039; ! -name &#039;.&#039; -execdir sh -c &#039;7z a -mx9 -mmt ~/backups/&quot;$1&quot;.7z &quot;$1&quot;&#039; : {} \;&lt;/pre&gt;

Hope this helps.</description>
		<content:encoded><![CDATA[<p>Just place the destination path before the <strong>&#8220;$1&#8243;.7z</strong> part like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-maxdepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*'</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'.'</span> <span style="color: #660033;">-execdir</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">'7z a -mx9 -mmt &lt;destination-path&gt;/&quot;$1&quot;.7z &quot;$1&quot;'</span> : <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;</pre></div></div>

<p>For example, if I wanted to compress each directory into a 7z archive and have them placed in the folder <strong>~/backups</strong> (where ~ gets substituted for the current users home directory, so for me would equate to <strong>/home/r3dux</strong>), I could use:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-maxdepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*'</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'.'</span> <span style="color: #660033;">-execdir</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">'7z a -mx9 -mmt ~/backups/&quot;$1&quot;.7z &quot;$1&quot;'</span> : <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;</pre></div></div>

<p>Hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pawel</title>
		<link>http://r3dux.org/2009/04/how-to-compress-a-directory-of-files-into-individual-archives/#comment-7458</link>
		<dc:creator>Pawel</dc:creator>
		<pubDate>Mon, 06 Feb 2012 00:22:21 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=439#comment-7458</guid>
		<description>Thanks for sharing this with us. I am almost there. Only thing which is missing is relocating 7z files to another location. adding -o&quot;/newpath/$1&quot;.7z and other combination did not work for me. Any suggestion please? I have over 630 GBs collection in front of me to be compressed and archived, so you assistance is highly appreciated.
Best,
Pawel.</description>
		<content:encoded><![CDATA[<p>Thanks for sharing this with us. I am almost there. Only thing which is missing is relocating 7z files to another location. adding -o&#8221;/newpath/$1&#8243;.7z and other combination did not work for me. Any suggestion please? I have over 630 GBs collection in front of me to be compressed and archived, so you assistance is highly appreciated.<br />
Best,<br />
Pawel.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: r3dux</title>
		<link>http://r3dux.org/2009/04/how-to-compress-a-directory-of-files-into-individual-archives/#comment-7457</link>
		<dc:creator>r3dux</dc:creator>
		<pubDate>Sun, 05 Feb 2012 22:29:57 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=439#comment-7457</guid>
		<description>I tried it with the -d instead of -f and got the &lt;strong&gt;..7z&lt;/strong&gt; file as well (which is a single archive of everything in all the directories). But I also noticed that the command went into every folder and compressed every subfolder into its own .7z file, too! Not what we want!

The fix for this is to tell find to only traverse 1 directory deep (&lt;strong&gt;-maxdepth 1&lt;/strong&gt; - keep this as the first parameter specifed or find will complain), and then also tell it to exclude the current directory we&#039;re running the command in (&lt;strong&gt;! -name &#039;.&#039;&lt;/strong&gt;).

The end result to compress all subdirectories in the directory where you run the command then becomes:

&lt;pre lang=&quot;bash&quot;&gt;find . -maxdepth 1 -type d -name &#039;*&#039; ! -name &#039;*.7z&#039; ! -name &#039;.&#039; -execdir sh -c &#039;7z a -mx9 -mmt &quot;$1&quot;.7z &quot;$1&quot;&#039; : {} \;&lt;/pre&gt;

But this will also exclude any directories that end with .7z, which you&#039;re unlikely to have, so a better version is:

&lt;pre lang=&quot;bash&quot;&gt;find . -maxdepth 1 -type d -name &#039;*&#039; ! -name &#039;.&#039; -execdir sh -c &#039;7z a -mx9 -mmt &quot;$1&quot;.7z &quot;$1&quot;&#039; : {} \;&lt;/pre&gt;

Cheers!</description>
		<content:encoded><![CDATA[<p>I tried it with the -d instead of -f and got the <strong>..7z</strong> file as well (which is a single archive of everything in all the directories). But I also noticed that the command went into every folder and compressed every subfolder into its own .7z file, too! Not what we want!</p>
<p>The fix for this is to tell find to only traverse 1 directory deep (<strong>-maxdepth 1</strong> &#8211; keep this as the first parameter specifed or find will complain), and then also tell it to exclude the current directory we&#8217;re running the command in (<strong>! -name &#8216;.&#8217;</strong>).</p>
<p>The end result to compress all subdirectories in the directory where you run the command then becomes:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-maxdepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*'</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.7z'</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'.'</span> <span style="color: #660033;">-execdir</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">'7z a -mx9 -mmt &quot;$1&quot;.7z &quot;$1&quot;'</span> : <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;</pre></div></div>

<p>But this will also exclude any directories that end with .7z, which you&#8217;re unlikely to have, so a better version is:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-maxdepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*'</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'.'</span> <span style="color: #660033;">-execdir</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">'7z a -mx9 -mmt &quot;$1&quot;.7z &quot;$1&quot;'</span> : <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;</pre></div></div>

<p>Cheers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pawel</title>
		<link>http://r3dux.org/2009/04/how-to-compress-a-directory-of-files-into-individual-archives/#comment-7453</link>
		<dc:creator>Pawel</dc:creator>
		<pubDate>Sun, 05 Feb 2012 18:38:41 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=439#comment-7453</guid>
		<description>Hi,
To compress multiple directories into separate archive files I modified your one liner by changing -type f to -type d and everything seemed to be fine except I was gettin a strange, huge ./.7z file besides all of the required archive files. Not sure what needs to be modified to make it work &#039;better&#039;.
Thanks,
Pawel.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
To compress multiple directories into separate archive files I modified your one liner by changing -type f to -type d and everything seemed to be fine except I was gettin a strange, huge ./.7z file besides all of the required archive files. Not sure what needs to be modified to make it work &#8216;better&#8217;.<br />
Thanks,<br />
Pawel.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: r3dux</title>
		<link>http://r3dux.org/2009/04/how-to-compress-a-directory-of-files-into-individual-archives/#comment-5816</link>
		<dc:creator>r3dux</dc:creator>
		<pubDate>Thu, 13 May 2010 06:52:16 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=439#comment-5816</guid>
		<description>Got a hit from a forum which saw the post, who also say that using &quot;~n&quot; will strip the file extension, for example:

&lt;pre&gt;for %f in (*.adf) do echo %~nf&lt;/pre&gt;

Just saving this info here for future reference! :)</description>
		<content:encoded><![CDATA[<p>Got a hit from a forum which saw the post, who also say that using &#8220;~n&#8221; will strip the file extension, for example:</p>
<pre>for %f in (*.adf) do echo %~nf</pre>
<p>Just saving this info here for future reference! <img src='http://r3dux.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James McDonald</title>
		<link>http://r3dux.org/2009/04/how-to-compress-a-directory-of-files-into-individual-archives/#comment-5804</link>
		<dc:creator>James McDonald</dc:creator>
		<pubDate>Mon, 10 May 2010 11:13:22 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=439#comment-5804</guid>
		<description>A belated &quot;You&#039;re Welcome!&quot; :)</description>
		<content:encoded><![CDATA[<p>A belated &#8220;You&#8217;re Welcome!&#8221; <img src='http://r3dux.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

