Jump to content

Copy path of selected file to clipboard


Migs

Recommended Posts

I have found how to do this in a service after creating an Automator workflow BUT:  I would like to have it be and alfred text that I can simply call from Alfred as such:  Open alfred typing box and type copypath and in the clipboard the path goes.  

As an aside, when I use the copypath as a service I cannot directly paste the path into an Excel cell.  I have to first copy it into a note and then copy it again from there and then paste it into a cell in Excel.  Can I correct this behavior in Automator prior to creating the service?  Or is there an altogether better way?

 

Thanks again amigos,

Migs

Edited by Migs
add info
Link to comment

Hi @Migs, You can use File Actions to copy the selected file's path to clipboard by finding your file in Alfred, pressing the right arrow (which will show you a list of File Actions) then selecting Copy Path to Clipboard. It'll then be copied to Alfred's clipboard, ready for you to paste in Excel. :)

 

Cheers,
Vero

Link to comment

Hi Vero:

In the attached screen shot I show a file and Alfred won't find it.  It goes straight to offer Google.  Thus I would rather select the file (much faster) and do something in Alfred to copy it's path to the clipboard.  As you will appreciate the path is quite long. (look at the bottom)

 

Thanks Vero,

 

Migs

 

alf.jpeg

Link to comment

If Alfred doesn't find your file, then there's a problem with your Spotlight index or it's not in your Alfred Search Scope. However, to get the path from your selection in Finder, just use the "Copy Path to Clipboard" action of Alfred File Action feature. To use it, make sure to assign a hotkey from the Alfred Preferences to get the file selection: "Alfred Preferences > Features > File Search > Actions > File Selection". Then, when you have the file selected in Finder, just use your hotkey to pop the Alfred's list of actions and look for the one named "Copy Path to Clipboard", press Enter and you should have it in your clipboard and you should be fine pasting it in Excel.

 

If you want to use a keyword instead the way you are saying it, then you will need a Workflow. So here is one if you prefer this solution: https://nofile.io/f/pmC0ht6SFGP/File+Path+To+Clipboard.alfredworkflow

Link to comment

@Migs First, could you please let me know how you're searching for this file?

 

You need to prefix your search term with the keyword "open" or press the spacebar to broaden the file types searched from the essential file types in the Default Results prefs to the rest of your Mac. 

 

Unless you've included Documents in your default search scope (not recommended), they won't pop up when you simply type "Medidas" for example.

 

So before we assume that there are indexing issues, could you please try searching by pressing the spacebar followed by your keyword, and let us know how you get on? :) 

 

Cheers,
Vero

 

 

Link to comment

Hi Verito

I just fixed the search scope.  I foolishly assumed all mounted volumes would be searched.  (I have many mounted volumes) That is why the file wasn't being found.  Let me explore your two solutions and see what works best.  Thanks for all your good will to me.

 

Migs

Link to comment

@Migs What exactly are you trying to do?

 

I explained how to copy the file path to clipboard in my first response:

 

On 11/10/2017 at 2:30 PM, Vero said:

You can use File Actions to copy the selected file's path to clipboard by finding your file in Alfred, pressing the right arrow (which will show you a list of File Actions) then selecting Copy Path to Clipboard. It'll then be copied to Alfred's clipboard, ready for you to paste in Excel. :)

 

To reiterate, when you either:

  • find the File in Alfred and press the right arrow to show File Actions, or
  • find a file in Finder and press the File Selection hotkey (Alt + Cmd + \ by default)

You will see the File Actions list like so:

file-actions.png

 

You'll then be able to choose "Copy Path to Clipboard" to copy the path of the file to your clipboard.

 

If we've misunderstood your question, could you please clarify what you're trying to achieve?

 

Cheers,
Vero

Link to comment
  • 1 year later...
On 11/14/2017 at 4:31 AM, Vero said:

@Migs What exactly are you trying to do?

 

I explained how to copy the file path to clipboard in my first response:

 

 

To reiterate, when you either:

  • find the File in Alfred and press the right arrow to show File Actions, or
  • find a file in Finder and press the File Selection hotkey (Alt + Cmd + \ by default)

You will see the File Actions list like so:

file-actions.png

 

You'll then be able to choose "Copy Path to Clipboard" to copy the path of the file to your clipboard.

 

If we've misunderstood your question, could you please clarify what you're trying to achieve?

 

Cheers,
Vero

 

About 5x per day I need a access a file path on my Mac IOS 10.13.6.  I have the latest version of Alfred.

 

Following your instructions, I 1) find the file in Alfred, 2) I highlight it, 3) I press the right arrow, and 4) NOTHING HAPPENS.  No "list of file actions" appears; hence, there is  no option to copy the path to the clipboard. 

 

What do you recommend?  

 

I purchased the powerpack and ownloaded the workflow file you mentioned for copying file paths, How/where do I install it so that Alfred will copy the file path names to the clipboard and/or at least enable me to access them? 

 

Thanks for your help - 

Edited by linda
Link to comment
On 3/5/2019 at 1:22 AM, linda said:

 

About 5x per day I need a access a file path on my Mac IOS 10.13.6.  I have the latest version of Alfred.

 

Following your instructions, I 1) find the file in Alfred, 2) I highlight it, 3) I press the right arrow, and 4) NOTHING HAPPENS.  No "list of file actions" appears; hence, there is  no option to copy the path to the clipboard. 

 

What do you recommend?  

 

I purchased the powerpack and ownloaded the workflow file you mentioned for copying file paths, How/where do I install it so that Alfred will copy the file path names to the clipboard and/or at least enable me to access them? 

 

Thanks for your help - 

 

Did you try tab instead of right arrow? It depends on your settings under Features ➡️ Files search ➡️ Actions.

Link to comment
  • 2 years later...

I came here to find a solution but it seems this behavior is already built into Mac as outlined here.

 

Just press Option + Command + C and the current file or folder will be copied to the clipboard. Alfred users may need to remap the Alfred Clipboard Viewer Hotkey to something else as mine was mapped to the same shortcut.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...