Mac OS X Lion (10.7), introduced a bunch of new features to the Mac platform. At the same time it’s taken away some things that experienced Mac users are used to. The idea was to remove things that the average user doesn’t need.
If your like me, you might have yelled “Hey! Where is the Library folder in OS X Lion?”, when trying to access data from the iPhone simulator.
After doing some research, I found that the folder was not gone, it had simply been hidden. Running the following command from the terminal, I was able to make my Library folder visible once again.
chflags nohidden ~/Library/
You may also need to restart finder by using this command
killall Finder && open /System/Library/CoreServices/Finder.app
If for some strange reason you want to go back to being a n00b and hide the Library folder again, you can use the following command
Just like my last post, I was working with a directory of about 1000 files. There were all sorts of problems with the way they were named. Anyone who is used a *nix type system will know that “.jpg”, “.Jpg”, “.JPG” are all very separate things. To solve the issue I was having I needed to rename all of the files in the directory to lowercase.
I fired up my friend the Mac terminal and ran the following command:
for i in *; do mv "$i" "$(echo $i|tr A-Z a-z)"; done
The code loops through each of the files in the current directory and renames it to the lowercase equivalent. fast, simple, elegant. Major time saver.
Recently I was presented with a problem where I had a directory of about 1000 graphic files of mixed formats (png, gif, bmp, jpg), and I needed to convert them all to jpg files.
I tried various solutions but I ended using the following command in my Mac’s terminal.
mkdir jpegs; sips -s format jpeg *.* --out jpgs
This command creates directory called “jpgs”, and converts all of the files in the current directory into .jpg format, and moves them into the newly created “jpgs” direcotry.
It truly saved the day.
“touch” is a handy unix utility to udate the time stamp on a file. Recenly I ran into a case on my mac book pro that required me to update all of the files and sub-directories of a project with the current date.
In terminal, I could have gone one by one an used this command on each file
But after a few moments of onterweb searching, I came across a perfect solution
find . -print0 | xargs -0 touch
This command will find all of the file in all sub-directories, even if they have spaces in their name, and set their last updated time to the current time.
Just a handy tip I thought I would share