How to Add "Copy Full File Path to Clipboard" to Finder's Services Menu
When working in Finder, you often need to copy the full path of a file to the clipboard. Using the built-in Automator on macOS, you can create a Quick Action that lets you do this with a single right-click.
Steps
1. Launch Automator
Open Spotlight (⌘ + Space), type "Automator", and launch it.
2. Create a New Document
Select "New Document" → "Quick Action".
3. Configure Settings
- Change "Workflow receives current" to files or folders
- Set "in" to Finder.app
4. Add a Shell Script
Double-click "Run Shell Script" from the action list on the left, then configure:
- Set the shell to /bin/bash
- Change "Pass input" to as arguments
- Enter the following script:
export LANG=ja_JP.UTF-8
for f in "$@"
do
echo -n "$f" | pbcopy
done
Note: The export LANG=ja_JP.UTF-8 line is needed to prevent garbled characters in non-ASCII file names. Automator's shell environment doesn't have locale settings enabled by default.
5. Save
Save with ⌘ + S. Name it something like "Copy Full Path".
Save Location
The workflow is saved as a .workflow file in ~/Library/Services/.
Usage
Select a file in Finder → Right-click → Find it under "Quick Actions".
Note: Since macOS Monterey, the "Services" menu has been consolidated into "Quick Actions".
Troubleshooting
If the action doesn't appear:
- Restart Finder:
killall Finder - Check System Settings → Keyboard → Keyboard Shortcuts → Services → Files and Folders to ensure the service is enabled
Copying Multiple File Paths with Newline Separators
Replace the script with:
export LANG=ja_JP.UTF-8
printf '%s\n' "$@" | pbcopy
This copies the paths of all selected files, separated by newlines.
We look forward to discussing your development needs.