mac_automatorLately I’ve needed to show .htaccess file in finder. In finder every file with a dot in front of it is hidden. You have to change this using shell commands. But this is a superfluous process. I scoured the internet and found ways to automate this. There are some software solutions but the way I will tell about is using the Automator


Step 1
Start up your Automator. It is under Tools in your Applications. On opening the Automator choose Custom. Choose Run Shell Script and drag it into the workflow area. Automator_Step_1


Step 2
In the input area copy the code:

step2

Code:

defaults write com.apple.finder AppleShowAllFiles TRUE
osascript -e 'tell application "Finder" to quit';
osascript -e 'tell application "Finder" to activate';


Step 3
From the top menu choose File -> Save As Plugin. This script will show the hidden files. Save it as ShowHiddenFiles.
showhiddenfiledialog


Step 4
We successfully created the Automator script to show the hidden files. Repeat the steps to create the script to hide the files again using the following:

Code:

defaults write com.apple.finder AppleShowAllFiles FALSE
osascript -e 'tell application "Finder" to quit';
osascript -e 'tell application "Finder" to activate';

and save it as plugin as HideHiddenFiles

Use it:
In finder you can use Control Click -> More -> Automator to access the Automator scripts you just created
infinder