<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>isambard &#187; unix</title>
	<atom:link href="http://isambard.com.au/blog/tag/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://isambard.com.au/blog</link>
	<description>musings on information design and architecture</description>
	<lastBuildDate>Mon, 30 Jan 2012 04:20:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Recursive folder content lists in OSX</title>
		<link>http://isambard.com.au/blog/2009/12/29/recursive-folder-content-lists-in-osx/</link>
		<comments>http://isambard.com.au/blog/2009/12/29/recursive-folder-content-lists-in-osx/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 09:09:32 +0000</pubDate>
		<dc:creator>steven</dc:creator>
				<category><![CDATA[Techniques]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://isambard.com.au/blog/?p=235</guid>
		<description><![CDATA[Every now and then you&#8217;re really grateful OSX is essentially Unix with a smiley face. Since that allows you to easily get under the hood for those &#8220;should be simple&#8221; tasks. For this one, I needed to produce a list of files within a collection of folders which, for demonstration purposes, we&#8217;ll call media files. [...]]]></description>
			<content:encoded><![CDATA[<p>Every now and then you&#8217;re really grateful OSX is essentially Unix with a smiley face.  Since that allows you to easily get under the hood for those &#8220;should be simple&#8221; tasks.<br />
For this one, I needed to produce a list of files within a collection of folders which, for demonstration purposes, we&#8217;ll call media files.</p>
<h2>Recursive file list</h2>
<p>This is easy:</p>
<ol>
<li>Open a terminal window</li>
<li>Type <code>cd </code> (there&#8217;s a space after &#8216;cd&#8217;)</li>
<li>Drag the folder you want to start from into the terminal window.  It should then complete the path automagically.</li>
<li>Press <strong>Enter</strong> to navigate to the selected folder.</li>
<li>Enter the command <code>ls -RF > list.txt</code></li>
</ol>
<p>This will produce a list of all files in the directory, and subdirectories, as list.txt in the starting directory. Feel free to give it a more useful name.</p>
<h2>Once more, with filters</h2>
<p>So now you&#8217;ve got a list of all the files in the folders.  But if you want to find a subset based on filename (say, for example, the list of media files identified in the title as being 2009 releases) then use the wonders of unix to &#8216;pipe&#8217; the file list to GREP to filter it before writing the file:</p>
<p><code>ls -RF | grep '2009' > 2009.txt</code></p>
<p>This will produce a list of only those files with &#8217;2009&#8242; somewhere in the title.</p>
<h2>Advanced options</h2>
<p>Armed with LS and GREP you can pretty much produce any subset of any folder set you require.  Enjoy!</p>
<ul>
<li><a href="http://developer.apple.com/mac/library/DOCUMENTATION/Darwin/Reference/ManPages/man1/ls.1.html">LS Reference (Mac OSX Library)</a></li>
<li><a href="http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/grep.1.html">GREP Reference (Mac OSX Library)</a></li>
</ul>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fisambard.com.au%2Fblog%2F2009%2F12%2F29%2Frecursive-folder-content-lists-in-osx%2F&amp;title=Recursive%20folder%20content%20lists%20in%20OSX" id="wpa2a_2"><img src="http://isambard.com.au/blog/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://isambard.com.au/blog/2009/12/29/recursive-folder-content-lists-in-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

