Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a script to show/hide hidden files in Mac OS X?

I just got my MBP with Retina and i'm really new to the Mac OS X (using PC before). I noticed that the Mac doesn't have a GUI to show/hide hidden files like Windows. I've researched and saw this site Show Hidden Files on your Mac. And yes, it works.

To show hidden files: (Using Terminal) defaults write com.apple.finder AppleShowAllFiles TRUE killall Finder

To hide hidden files: defaults write com.apple.finder AppleShowAllFiles FALSE killall Finder

What i wanted to do is to make an executable script that will perform the above commands when i double-click it so that i don't have to type commands in Terminal in order for me to show/hide hidden files. I saw Applescript but i'm not very familiar with it. I don't know the commands to perform what i want. But i've read some.

Can someone please help me make an executable script that will show/hide hidden files in my Mac?

like image 683
daremigio Avatar asked Dec 09 '13 11:12

daremigio


2 Answers

You don't need script anymore. Open the finder, press + ⇧ Shift + . and it will show/hide your files.

like image 109
krmanish007 Avatar answered Sep 18 '22 15:09

krmanish007


display dialog "Show all files" buttons {"TRUE", "FALSE"}
set result to button returned of result
if result is equal to "TRUE" then
    do shell script "defaults write com.apple.finder AppleShowAllFiles -boolean true"
else
    do shell script "defaults delete com.apple.finder AppleShowAllFiles"
end if
do shell script "killall Finder"  

enter image description here

Use AppleScript editor and save as application.

enter image description here

like image 22
Parag Bafna Avatar answered Sep 19 '22 15:09

Parag Bafna