Copying the name of the file selected in Finder?

Is there a command that copies file/foldername to the clipboard? I didn't find such token.

Do you mean the selected file/folder selected in the Finder?

Yes, thanks

The Token you are looking for is %FinderSelection%. You can use this to copy the full path including file name of the item selected in the Finder to the Clipboard.

If you want to split this into different bits (the path, the filename, extension etc) you can do that by using the Action Get File Attribute to get the element you want (for example the file name) to a Variable. And then set the Clipboard to that Variable.

Copy Filename to Clipboard from Finder Selection.kmmacros (2.6 KB)

3 Likes

Thank you!

Hey Guys,

I almost never use the file attributes action for this kind of thing anymore. I use the Split Path action instead, because it's so much more flexible:

image

-Chris

4 Likes