<?xml version="1.0" encoding="utf-8"?><!-- generator="wordpress/1.5.1.3" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Bash Scripting Tip: processing filenames with spaces</title>
	<link>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/</link>
	<description>Infinity,  n.: pl. Infinities: Unlimited extent of time, space, or quantity: eternity: boundlessness: immensity.</description>
	<pubDate>Wed, 07 Jan 2009 14:21:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.1.3</generator>

	<item>
		<title>by: Johan</title>
		<link>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/#comment-3060</link>
		<pubDate>Thu, 21 Aug 2008 05:48:13 +0000</pubDate>
		<guid>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/#comment-3060</guid>
					<description>All is fair in love and war, but why wont my script work? :(

It only iterates over the first occurance.
-------------
~/music/ $ find ./ -iname &quot;*.flac&quot; &amp;#166; while read I; do ffmpeg -ab 160k -i &quot;$I&quot; &quot;$I.mp3&quot;; mv &quot;$I.mp3&quot; mp3/; done;
-------------</description>
		<content:encoded><![CDATA[	<p>All is fair in love and war, but why wont my script work? :(</p>
	<h2>It only iterates over the first occurance.</h2>
	<h2>~/music/ $ find ./ -iname &#8220;*.flac&#8221; | while read I; do ffmpeg -ab 160k -i &#8220;$I&#8221; &#8220;$I.mp3&#8243;; mv &#8220;$I.mp3&#8243; mp3/; done;</h2>
]]></content:encoded>
				</item>
	<item>
		<title>by: marc</title>
		<link>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/#comment-2791</link>
		<pubDate>Fri, 30 Mar 2007 09:46:14 +0000</pubDate>
		<guid>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/#comment-2791</guid>
					<description>Hi Pablo, that actually doesn't work with file names or paths with spaces which is the reason for the post in the first place.  Reading each line into a variable with the described method protects the spaces in path and file names.  It would work if your paths/filenames don't have spaces though.

Thanks.</description>
		<content:encoded><![CDATA[	<p>Hi Pablo, that actually doesn&#8217;t work with file names or paths with spaces which is the reason for the post in the first place.  Reading each line into a variable with the described method protects the spaces in path and file names.  It would work if your paths/filenames don&#8217;t have spaces though.</p>
	<p>Thanks.</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Pablo</title>
		<link>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/#comment-2790</link>
		<pubDate>Fri, 30 Mar 2007 05:57:10 +0000</pubDate>
		<guid>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/#comment-2790</guid>
					<description>nice trick. find is nice because it has soo many options, but if all we need is a set of files matching a pattern,

find $path_to_mpgs -iname '*.mpg' &amp;#166; while read I; do echo &quot;$I&quot;; done

could be replaced with:

for I in $path_to_mpgs/*.mpg; do echo &quot;$I&quot;; done

(bash can do some of the work)</description>
		<content:encoded><![CDATA[	<p>nice trick. find is nice because it has soo many options, but if all we need is a set of files matching a pattern,</p>
	<p>find $path<em>to</em>mpgs -iname &#8216;*.mpg&#8217; | while read I; do echo &#8220;$I&#8221;; done</p>
	<p>could be replaced with:</p>
	<p>for I in $path<em>to</em>mpgs/*.mpg; do echo &#8220;$I&#8221;; done</p>
	<p>(bash can do some of the work)</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: fabe</title>
		<link>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/#comment-2415</link>
		<pubDate>Sat, 25 Feb 2006 10:44:52 +0000</pubDate>
		<guid>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/#comment-2415</guid>
					<description>Great!! Perfect, to pipe find into the loop. Tricky. Thanks.</description>
		<content:encoded><![CDATA[	<p>Great!! Perfect, to pipe find into the loop. Tricky. Thanks.</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: marc</title>
		<link>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/#comment-2370</link>
		<pubDate>Wed, 25 Jan 2006 04:39:17 +0000</pubDate>
		<guid>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/#comment-2370</guid>
					<description>Hey Shawn,

I appreciate the comment!  I'm glad it helped - that's exactly why I wrote it up :)</description>
		<content:encoded><![CDATA[	<p>Hey Shawn,</p>
	<p>I appreciate the comment!  I&#8217;m glad it helped - that&#8217;s exactly why I wrote it up :)</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Shawn Dowler</title>
		<link>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/#comment-2369</link>
		<pubDate>Wed, 25 Jan 2006 04:25:08 +0000</pubDate>
		<guid>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/#comment-2369</guid>
					<description>Thanks for this tip!  I'd been agonizing over this for about 30 minutes until I found your site.  Had I not it would have been trial and error all night until I got it right :)</description>
		<content:encoded><![CDATA[	<p>Thanks for this tip!  I&#8217;d been agonizing over this for about 30 minutes until I found your site.  Had I not it would have been trial and error all night until I got it right :)</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: marc</title>
		<link>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/#comment-2034</link>
		<pubDate>Sun, 16 Oct 2005 14:22:59 +0000</pubDate>
		<guid>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/#comment-2034</guid>
					<description>Thanks, fixed...</description>
		<content:encoded><![CDATA[	<p>Thanks, fixed&#8230;</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Darrell</title>
		<link>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/#comment-2033</link>
		<pubDate>Sun, 16 Oct 2005 12:01:48 +0000</pubDate>
		<guid>http://blog.mecworks.com/articles/2005/09/23/bash-scripting-tip-processing-filenames-with-spaces/#comment-2033</guid>
					<description>You have a minor typo in your mp3 copying example: the first &quot;$I&quot; should just be &quot;I&quot;, as in your first example.  So it should read:

find /path/to/files/ -iname &quot;*mp3&quot; &amp;#166; \
while read I; do
   cp -v --parent &quot;$I&quot; /backup/dir/
done</description>
		<content:encoded><![CDATA[	<p>You have a minor typo in your mp3 copying example: the first &#8220;$I&#8221; should just be &#8220;I&#8221;, as in your first example.  So it should read:</p>
	<p>find /path/to/files/ -iname &#8220;*mp3&#8243; | \<br />
while read I; do<br />
   cp -v &#8211;parent &#8220;$I&#8221; /backup/dir/<br />
done</p>
]]></content:encoded>
				</item>
</channel>
</rss>
