To use a local text path in Mac Shortcuts, pass an existing file through the command-line -i option, or locate a file or folder in Finder and send the selected item to a shortcut. These documented routes preserve the distinction between path text and file input.
This walkthrough covers one desktop task: starting with a pathname and getting the corresponding existing item into a shortcut for inspection. Apple explicitly documents that piping a pathname supplies text, while -i treats the input as file paths. For folders, the Finder route below provides a documented alternative without assuming undocumented command-line directory behavior. Run shortcuts from the command line.
What has to change between path text and file input?
Apple lists Text, Files, and Folder as distinct shortcut input types. A pathname describes a location; the intended result here is the existing item at that location, available to an action that accepts it. Selecting an allowed input type establishes what a shortcut accepts from another app. Understanding input types in Shortcuts on Mac.
The official pages cited here do not establish a universal in-workflow text-to-file-or-folder cast. They do establish ways to supply the item at the shortcut’s entry point. If your requirement is specifically an entirely internal conversion midway through a running shortcut, these instructions establish a supported alternative, rather than claiming that conversion has been verified.
Choose the route according to your starting point:
| Starting point | Route used here | Where the item enters Shortcuts |
|---|---|---|
| An existing file’s pathname in Terminal | Run the shortcut with -i |
Shortcut Input |
| An existing folder’s pathname | Navigate in Finder, select the folder, then run the shortcut | Shortcut Input |
| An existing file’s pathname during desktop work | Navigate to its parent folder and select the file | Shortcut Input |
Prepare disposable examples and an inspection shortcut
Use only new synthetic material for the walkthrough. In Finder, open your home folder and create a folder named Shortcuts Path Demo using File > New Folder. Inside it, create another folder named Sample Folder. Apple documents creating folders in the selected Finder location with this command. If either name already exists, choose a fresh name and adjust the later examples accordingly. Organise files in folders on Mac.
Next, create a new document in TextEdit containing only Sample text for a path test. Choose Format > Make Plain Text, then File > Save. Save it as Sample Note.txt inside the new Shortcuts Path Demo folder. Verify the saved name in Finder before proceeding. TextEdit documents both plain-text conversion and choosing a save location. Create, open, and convert documents in TextEdit on Mac.
In Shortcuts, create a shortcut named Inspect Local Item. Use the toolbar’s add button, enter the name, and add the View Content Graph action by searching the action library. Apple documents manually creating shortcuts and adding actions; its input-types guide specifically recommends a shortcut containing only View Content Graph to inspect what another app supplies. Create a custom shortcut on Mac, Understanding input types in Shortcuts on Mac.
Open the shortcut’s Details and enable Use as Quick Action, then enable Finder. In the input declaration at the top of the editor, click the current input types and retain file and folder input. Connect View Content Graph to Shortcut Input. Apple notes that file or folder input may need to be enabled before Finder is available. Run a shortcut while working on your Mac.
For an empty-input run, choose Stop and Respond in the input declaration and enter Select a sample file or folder first. This makes the demonstration’s prerequisite explicit instead of letting the workflow continue with an empty variable. Apple documents this response alongside the alternative empty-input behaviors. Limit the input for a shortcut when run from another app on Mac.
Pass an existing file path from Terminal
After saving the sample file and creating the shortcut, run this command in Terminal. It is a complete invocation for the sample setup above:
shortcuts run "Inspect Local Item" -i "$HOME/Shortcuts Path Demo/Sample Note.txt"
The quoted pathname stays together despite its spaces. Apple’s Terminal guide explains pathname quoting, and its Shortcuts command-line guide documents the -i option. Inspect the received content in the graph before extending the shortcut. This command is provided from documentation and has not been executed in a Mac session here. Specify files and folders in Terminal on Mac, Run shortcuts from the command line.
For a different disposable file, obtain its actual pathname in Finder: right-click the item, hold Option, and choose the command ending in as Pathname. Use that pathname as the quoted argument after -i. Copying it avoids reconstructing folder names by hand. Specify files and folders in Terminal on Mac.
Keep the argument attached to -i; piping the pathname into the command supplies text. Also keep this demonstration to one explicitly named file. Apple supports multiple paths and wildcards, but those introduce additional input items beyond this single-item task. Run shortcuts from the command line.
Turn a folder pathname into selected Finder input
For the sample folder, switch to Finder and choose Go > Go to Folder. Enter ~/Shortcuts Path Demo/ and press Return. Select Sample Folder inside the resulting window. Apple documents entering or pasting folder pathnames, including ~ for the home folder. Go directly to a specific folder on Mac.
Select the folder itself before invoking the shortcut. Navigating to its parent makes that selection straightforward: the item you want to pass is visible in the window. For a file, use the same sequence with its parent folder, then select the file.
With the sample item selected, use Finder’s Action pop-up menu and choose Services > Inspect Local Item. Apple also documents running enabled shortcuts through the selected item’s Quick Actions menu. Inspect the input graph produced by the shortcut. Run a shortcut while working on your Mac.
This is a desktop handoff: Finder resolves the navigation path, and the selected item becomes shortcut input. It requires selection rather than providing an automated conversion inside an existing shortcut. Use it when the practical goal is to start processing a known folder without relying on an unverified conversion recipe.
Check types, missing items, and name collisions
Before adding your real processing steps, check the next action’s input and output description. In the action library, hover over an action and click its information button. For an action already in the workflow, Control-click its icon and choose Show Info. Apple documents that this description includes accepted input and resulting output. Match the received item to those requirements. Navigate the action list in Shortcuts on Mac.
Use this diagnostic order when the handoff does not behave as expected:
- Confirm that the synthetic item still exists in Finder and that its name matches the pathname you supplied.
- For Terminal input, confirm that the pathname follows
-iand is enclosed in straight quotation marks when it contains spaces. - For Finder input, confirm that you selected the item and that the shortcut accepts the corresponding file or folder type.
- Inspect
Shortcut Inputbefore connecting downstream actions. Apple recommendsView Content Graphfor discovering received content andQuick Lookbetween actions for inspecting content flow. Understanding input types, Testing your actions.
Treat existence and creation as separate requirements. These examples begin with saved items; a pathname for a proposed future file does not satisfy that prerequisite. If you rename or move a sample, copy its pathname again before repeating the test.
The inspection workflow has no save, move, or rename step, so it requires no destination collision policy. During sample preparation, choose a fresh name whenever one is occupied. If you later add an action that writes files, inspect that action’s documented options separately; this walkthrough establishes no overwrite or automatic-renaming behavior.
Once the graph shows the intended item, connect Shortcut Input directly to an action whose documented input accepts it. For an existing file path, the command-line entry point is the concise route. For an ordinary desktop folder task, Finder selection provides a documented handoff with an inspectable result.
Sources
- Run shortcuts from the command line — Apple Support.
- Understanding input types in Shortcuts on Mac — Apple Support.
- Organise files in folders on Mac — Apple Support.
- Create, open, and convert documents in TextEdit on Mac — Apple Support.
- Create a custom shortcut on Mac — Apple Support.
- Run a shortcut while working on your Mac — Apple Support.
- Limit the input for a shortcut when run from another app on Mac — Apple Support.
- Specify files and folders in Terminal on Mac — Apple Support.
- Go directly to a specific folder on Mac — Apple Support.
- Navigate the action list in Shortcuts on Mac — Apple Support.
- Testing your actions in Shortcuts on Mac — Apple Support.