MacMusic  |  PcMusic  |  440 Software  |  440 Forums  |  440TV  |  Zicos
path
Recherche

10 Ways To Get a File Path On a Mac

lundi 17 mai 2021, 17:00 , par MacMost
If you need to see or copy the full path to a file, there are many ways to do it on a Mac. You can use one of several techniques in the Finder, in the document window, or while searching. You can easily place the path into a document or the Terminal. We'll also look at an Automator Quick Action that will show the path as a notification and copy it.



Check out 10 Ways To Get a File Path On a Mac at YouTube for closed captioning and more options.
Video Transcript: Hi this is Gary with MacMost.com. Today let me show you ten ways you can find the full path to any file on your Mac.
MacMost is brought to you thanks to a great group of more than 1000 supporters. There you can read about the Patreon Campaign. Join us and get exclusive content and course discounts.
Now one of the most common questions people ask online about Macs is how to find the path to a file. I'm going to show you not one but more than ten ways to fine the file path. Here in the Finder you can select any file you want and then use File and then Get Info or Command i. This will bring up the Info window and in there you can see the path. You can even select it and if you use Command C to Copy and then go to a document, I've got a TextEdit document open here. You could Paste it in. It will Paste in the path name. So as you can see this is a more literal path as the computer sees it whereas this one is a little more human readable including the name of the hard drive and putting little triangles between each folder.
Now there's an alternative to the Info window. That's the Inspector. So you can go to File and Get Info but before you select it hold the Option key down and it changes to Show Inspector. The shortcut is simply Option Command i. This brings up what looks like the same window. But this is actually a floating window that will stay on top and change depending upon what's selected. So if I select another file it will stay on top and show me the path to that file which in this case is the same thing. But if, for instance, you went to Recents then you could select different files in here and see the different paths to each one.
Now in the Finder it's very easy to see the path of the folder that you're looking at. That's by using the Path Bar. If you don't have it turned on already got to View and then Show Path Bar or Option Command P. Then at the bottom here you'll see the path. You can actually Copy this as well. Select what level you want to Copy. So I'll go all the way down here to Local Document. Control Click on it and I could Copy that Path Name and you can see I get that path. So I could also just Copy from this level and I get just that path. If I select a file it gives me the full path to that file as well. The great thing about this is that it works in Search results too. So if I do a Search for all Files that match a name and I get the results here I can select the file. I can see the path to it which is very useful when you're looking through a bunch of results and you want to find the one that matches but it's in a certain folder.
Now another way to see the path for the current folder you're looking at is to Command Click on the Name at the top here. If you do so you get a full list all the way back to the hard drive level and you can select one of these to jump to that level. If you'd rather not have to hit Command for that you can go to View, Customize Toolbar and then add the Path Button. Then the Path Button does the same thing but it's just a simple click.
Now if you select a file and then you use Edit, Copy or Command C and then you go to Paste it into a text document you'll just get the name of the file. But instead if you notice if you go to Edit and where it says Copy you hold the Option key down it says Copy as Path Name. So Option Command C will do that and then you could paste in the path to that file.
But you can also do this with a simple Drag and Drop. So I can take a file and Drag and Drop it to a text document like this and it will put, not the file of course, in there but the path to the file.
Now if you Open a file at the top you've got the title. Just like with the Finder you can Command Click it and get the full path and jump to any level that you want in there. So using one of these with Folders in it will actually open up new finder window pointed to that folder.
Now often when people are asking how to get the path to a file the reason they want it is because they want to use it in the Terminal. There are some easy ways to get the path of a file and have it instantly appear in the Terminal. One of those is to simply Drag and Drop. So, for instance, if I wanted to see the contents of a simple file in the Terminal I could use the cat command and I could Drag and Drop the file into the Terminal window and it will place wherever the text cursor was. So you could see here it placed the full path, including a backslash before the space is which is really handy because we often forget to type that.
Now you can also use Copy and Paste for this. But instead of having to Option Command C to copy the path just a regular Command C will work. So if I select a file like this one, Command C, and then go to Terminal and Command V to Paste it will paste in the path.
But what about searching for a file in Spotlight. A lot of times when you search for a file you don't necessarily want to go to the file. You just want to see where it is. So let's do a Search and I'll just search for a simple name like this. I'll get some documents as a result. Then I could select a document and I'll get a Preview here on the right. Still no path though. But if you hold the Command key down that path will appear down here. In addition any file that you have selected, of course, you can click on it again and it will open up. But using Command R with the file selected will actually open up a Finder window and select that file.
Here's a bonus advance way to do it. Let's say you wanted to make a quick keyboard shortcut that will give you the file path for anything selected in the Finder. You can build that in Automator. So let's run Automator here. I'm going to create a new document and make it a Quick Action. Then I'm going to Add into it Set Variable because what's going to happen here is this workflow will receive and I'm going to set it to Files or Folders in the Finder. So I'm going to take the input of this, which would be a selected file. Set it to a variable. So I'm going to create a variable called File Path. Now I need to do something with it. First let's have it display as a Notification. So I'll put it down here. No Title, No Subtitle. Just here I'm going to drag File Path to it. If you don't see this window here you can click there to bring up the variables. So now it will display it as a Notification and in addition to that let's Copy it to the Clipboard. So I'll just put Copy to Clipboard right underneath this. So it will display Notification with the path. Copy it to the Clipboard. Perfect. Let's Save and I'll call this Get File Path. So in the folder here I can Control Click on this file. I'll go to QuickActions. Get File Path. You could see it quickly displayed the Notification there. It does it really quickly the first time for some reason but it will take longer after that. Let's go now to System Preferences and under Keyboard, Shortcuts since we've run this once it should appear under Services here. Under Files and Folders. Get File Path. There it is. Let's add a shortcut. Let me do Control Option Command P for path. We could see it added that. Now if we use that shortcut we could see it appears there a little bit longer, and then also we could go in and Paste the results there so that there's that file there. Let's go to this one and there's the path for that one. I can Dismiss it and Paste that in. So now you've got a handy little shortcut.
So there's more than ten ways to find the path for a file that you see in the Finder or perhaps have opened already. Hopefully one of these will work for any situation that you come across. Hope you found this useful. Thanks for watching. Related Subjects: Automator (44 videos), Finder (221 videos)
Related Video Tutorials:
Create a New Text File Anywhere With a Keyboard Shortcut On a Mac ― 10 Ways You Can Preview Files On Your Mac ― 10 Different Ways To Move Files On a Mac ― 10 Ways To Use Mac Finder Aliases
https://macmost.com/10-ways-to-get-a-file-path-on-a-mac.html
News copyright owned by their original publishers | Copyright © 2004 - 2024 Zicos / 440Network
Date Actuelle
ven. 29 mars - 03:36 CET