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
Recently, I got a mac laptop at work, which is sup[er sweet, but I wanted to hook it up to a real monitor, keyboard and mouse. All very easy things to do. The problem I had was that the laptop was acting as the primary monitor. Every application that I drug over to the secondary monitor worked great, but the application tool bar was still on the laptop.. annoying.
I did a quick Google search to see if there was a solution to the problem. There was, and it’s dead simple to put into action.
Connect the external monitor
- Start up the “System Preferences” app
- Click on “Display Preferences”
- Within Display Preferences, choose Arrangement. You should see two blue squares that represent each display, main and secondary. On the main display you’ll notice a bar along the top.
- Click and drag this bar from the Main Display to the Secondary Display.
- Close Display Preferences
- That’s it!
Firefox 3 is awesome we all know that, but there are some things that that would just be nice to have. One of those things would be the ability to control what appears for the auto suggest when you type in the URL bar.
Most of the time FireFox does a very good job of figuring out what you want to do, but when it goes bad, it goes really bad and gets annoying fast.
The other day I accidentally typed in “google.com/a”, and from that moment time on, everytime I wanted to go to “google.com”, it would auto complete to “google.com/a”, and i would end up going there. Very annoying.
I searched the Firefox menus but couldn’t find anything to help. I didn’t want to wipe out all of the auto complete entries, I find most of them helpful. I did some research and realized that you can remove these entries manually, but you have to do it in an unconventional way.
How remove those unwanted auto suggest entries
1. The list appears as you type something.
2. Select an entry by pointing you mouse at the item in the list, it will highlight.
3. Press Shift + Delete from your keyboard to delete the entry.
That’s all! You can remove entries from the address bar. This trick works on any Firefox auto complete list, including text fields and other dropdown suggestions.
This also works on windows, mac and linux machines