Mastering the Tao of Personal Computing

my del.icio.us: ArticleS.UncleBob.TheThreeRulesOfTdd: Every programmer needs to bookmark this one http://bit.ly/6jONm 12 hrs ago

Copying a file name to the clipboard on Mac OS X

May 11th 2008
No Comments
respond
trackback

Well, to copy the file name and the location of the file to the clipboard on a Mac OS X and then paste it in your texts is not a common task. But imagine you need to do it. The most intuitive approach is to open the Finder application and navigate to the file. If you need just the file name, without it’s location, you can just click on the name, thus entering in edit mode, then select the whole name and copy it with the Command-C keyboard shortcut.
Click Select File Name Screenshot
If you need not just the name but also the location of the file, most probably you’ll open the Get Info dialog for the specified file, and then just try to copy the text. Ooops, you can’t, because the text is not selectable.
Open Get Info Dialog ScreenshotGet Info Dialog Screenshot
On the Windows XP operating system the location of the file is selectable, so you can copy it to the clipboard. All you need to do is to open the Properties dialog:
Copy File Location on Windows Screenshot
I can’t think of a logical reason, why the Mac OS X designers have decided to make these texts not selectable. You can always write the file name and its location by hand, but there is a way to guarantee that you write it down correctly and also to speed up the writing of the file name.

To do that open the Terminal application, and start typing the change directory command, which is cd followed by the new location. When you type the location you can start with / - the root directory, type few symbols, then hit Tab and the command shell will try to auto complete the rest of the directory name, thus assuring you that what you type is correct.

You should be aware of that the command shell is case sensitive, so if the auto completion doesn’t work, probably you’ve started typing with the incorrect case. When you’ve done typing the file location, instead of executing the cd command, you can select and copy that location.
Copy File Location From Terminal Screenshot
If there are any spaces in the file location, the command shell will escape them prefixing every space with the \ escaping symbol.

The moral of the story is that designers work rather with great variety of assumptions than with fixed requirements about how the creation is going to be used. In this particular case the Windows designers have predicted correctly that copying the file name might be in handy, in opposite to the Apple designers which have easily overlooked this mini feature.

To be honest I haven’t done any thorough research on how to accomplish copying the file name to the clipboard on Mac OS X and I’ve approached the problem as I would approach it in Windows. But it turns out that there is even easier way to copy the file name. You need to open the Finder application, navigate to the file location, select the file, then chose from the main menu Finder>Services>TextEdit>New Window Containing Selection. The TextEdit application will open a window that contains the file name encoded in URL encoding.
Copy File Name from Services Menu


This post is tagged , , , , , , , ,

No Comments

Leave a Reply