I have an iRiver MP3 player, a deck in my car that plays MP3s from a USB stick, a stereo at work that plays MP3s from a USB stick, a PC that I play MP3s from an SD card, and a DVD player that plays DivX movies from a USB stick. Bottom line: I move a lot of MP3 and DivX files around. The one thing that all of these non-Apple environments have in common is that they are unfriendly to the various dot files that the Mac OS sprinkles around liberally. So I decided to craft myself a solution to eliminate these files easily. The solution I came up with is probably over-engineered in some ways and under-engineered in other ways. It's kind of complicated, but hopefully not too complicated. Some basic proficiency with AppleScript, unix and the Terminal is assumed. If you're not comfortable with all of these, then this example is probably not for you. The solution has three components:
Let's start with the shell script. First you'll want a place to keep it.
Being a long time unix user who crafts a lot of his own tools, I
usually have my own So, here's the shell script. You can use your favorite editor to cut and paste the following. I named the file nodots.sh.
After saving this in
A few notes about the script.
Now on to the AppleScript. You can cut and paste the following into an empty AppleScript. You will want to save this file as an application (I called it nodots without the .app extension) in HardDisk --> Library --> Scripts --> Finder Scripts (where HardDisk is your top level).
This script finds the path from whence it was called and
then runs nodots.sh in that directory. Most of the trickery is about finding the calling path. There are still some random messages that are occasionally returned by "do shell script", so as added precautions against unwanted messages, I set the result to a variable called "junk" which is promptly ignored and I pipe the stderr from the shell script to /dev/null... which unix geeks like to call the bit bucket.
You may want to add a custom icon at this point. Here's the one I use (I'm not much of an artist, but I think it gets the point across [no pun intended]): Next drag the script/app to the toolbar of an open Finder window to install it (you may have to click the oval button in the top right hand corner of the window to toggle the toolbar). It should look something like this:
OK, one last step. On each volume (AKA disk or drive) that you want to be able to remove the dot files you need a small file... and when I say small, I mean 0 bytes. Here's how you can do this from the terminal. First, open a terminal window. Type "cd" followed by a space and then drag the icon for the volume you are interested in to the terminal window and hit return. This should make the top level of the drive your current working directory. Now type the following in the terminal window:
I use "Get Info" to lock the file so I don't accidentally remove it when I'm moving files around. You can drag-copy the !UnDotAble file between disks, but it is ill-advised to leave copies lying around on disks where you don't want to accidentally remove dot files. If you simply must - bury it in an otherwise empty folder somewhere.
BTW, you will need to either quit the terminal or cd to another
directory before you can eject the volume. You will get a disk-in-use
error otherwise.
To use, just move the files you want to your removable drive, open that drive so that you see a window similar to above and click on the nodots icon. Now you can eject your disk dot file free. Note: As soon as you plug your disk back into a Mac some hidden Trash and Spotlight files will be re-created. |

