<?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>Jon Knapp &#187; OSX</title>
	<atom:link href="http://jonknapp.com/tag/osx/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonknapp.com</link>
	<description>byte artist</description>
	<lastBuildDate>Sat, 20 Aug 2011 07:48:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Toggle hidden file viewing in Mac OS X</title>
		<link>http://jonknapp.com/2008/04/toggle-hidden-file-viewing-in-mac-os-x/</link>
		<comments>http://jonknapp.com/2008/04/toggle-hidden-file-viewing-in-mac-os-x/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 04:49:30 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[Finder]]></category>
		<category><![CDATA[hidden files]]></category>
		<category><![CDATA[hidden folders]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[OSX]]></category>

		<guid isPermaLink="false">http://cupof.coffeeandcode.com/?p=10</guid>
		<description><![CDATA[My one regret with OS X&#8217;s Finder is that I have found no easy way to toggle viewing hidden files and folders. In fact I was so perturbed that I went and wrote a small application to toggle hidden file and folder visibility when ran. There are a couple of sites out there that show [...]]]></description>
			<content:encoded><![CDATA[<p>My one regret with OS X&#8217;s Finder is that I have found no easy way to toggle viewing hidden files and folders.  In fact I was so perturbed that I went and wrote a small application to toggle hidden file and folder visibility when ran.</p>
<p>There are a <a href="http://www.osxfaq.com/DailyTips/02-2005/02-01.ws">couple</a> <a href="http://www.macosxhints.com/article.php?story=20010328120852495">of</a> <a href="http://lifehacker.com/software/command-line/show-hidden-files-in-finder-188892.php">sites</a> out there that show the way to do it, but none are that graceful.  They require the user to force restart Finder (which is not desirable) and they usually call upon the use of Terminal and typing out the full command.</p>
<p>Not satisfied with a simple answer, and trying to avoid actual work, I decided to write up an AppleScript that would toggle the visibility of hidden files and folders from &#8220;on&#8221; to &#8220;off&#8221; every time you clicked it.  I then packaged it up in a pretty little application, and even gave it a custom small icon so you can drag it to the right side of current icons in a Finder window and it looks pretty sharp.  I got the icon idea from <a href="http://lifehacker.com/373507/set-up-better-time-machine-access">here</a>.</p>
<p>Here&#8217;s the <a href="http://www.coffeeandcode.com/products/toggle/toggle.zip">application</a>!  Hope it helps you out like it did for me.</p>
<p>And for those out there that like code:<br />
[sourcecode language="sh"]<br />
# Jonathan Knapp<br />
# Caffeinated Solutions<br />
# www.coffeeandcode.com</p>
<p># This application toggles the visiblity of hidden files and folders in Mac OSX.<br />
set userCancelled to false<br />
try<br />
	# give the user a warning about the negative effects of restarting Finder<br />
	set alertResult to display alert &#8220;Warning! Restarting Finder can have bad results on opened files. Are you sure you want to continue?&#8221; buttons {&#8220;Sure!&#8221;, &#8220;Not really&#8230;&#8221;} as warning default button &#8220;Not really&#8230;&#8221; cancel button &#8220;Not really&#8230;&#8221;<br />
on error number -128<br />
	# user hit the cancel button<br />
	set userCancelled to true<br />
end try</p>
<p># if the user wants to proceed&#8230;<br />
if userCancelled is false and button returned of alertResult is &#8220;Sure!&#8221; then<br />
	try<br />
		# get the current value; an error is thrown if none exists<br />
		set currentValue to do shell script &#8220;defaults read com.apple.finder AppleShowAllFiles&#8221;<br />
		if currentValue is &#8220;TRUE&#8221; then<br />
			set currentValue to &#8220;FALSE&#8221;<br />
		else<br />
			set currentValue to &#8220;TRUE&#8221;<br />
		end if<br />
	on error<br />
		# there are a couple errors that could catch here if the AppleShowAllFiles has no current value (ran for the first time)<br />
		set currentValue to &#8220;TRUE&#8221;<br />
	end try</p>
<p>	do shell script &#8220;defaults write com.apple.finder AppleShowAllFiles &#8221; &#038; currentValue<br />
	do shell script &#8220;osascript -e &#8216;tell application &#8220;Finder&#8221; to quit&#8217;&#8221;<br />
	do shell script &#8220;osascript -e &#8216;tell application &#8220;Finder&#8221; to activate&#8217;&#8221;<br />
end if<br />
[/sourcecode] </p>
]]></content:encoded>
			<wfw:commentRss>http://jonknapp.com/2008/04/toggle-hidden-file-viewing-in-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

