Automator: Service to list File Paths of selected items, into Text File
If you're looking for something that's more "pure Automator," here's one option (although, as was mentioned in the comments, right-clicking on the items in Finder, holding option, and selecting Copy Items as Pathnames
is probably the easiest solution):
- Accepts
files or folders
inFinder
- Set Value of Variable
Inputs
- Run Shell Script:
/usr/bin/dirname "$1"
(make sure to pass inputas arguments
) - Set Value of Variable
Parent Folder
- Get Value of Variable
Inputs
<-- this should not accept input (right-click on the action and selectIgnore Input
) - New Text File (
Plain text
, [whatever file name you want],Parent Folder
(drag this in from the variables list))
I've included a screenshot below:
No script is needed, as this is already built into Finder (this works for one or multiple files):
Right click on the file(s) in Finder
Press and hold option
Select
Copy [file name] as Pathname
(orCopy [#] Items as Pathnames
for multiple files) in the context menuThe pathnames are now saved to your clipboard. You can paste them into Notes or a text file