Save File

Stores a file in a vault via the file system (not the Obsidian API).

Tip: It is not obvious in Shortcuts, but long-tapping (iOS) or right-clicking (macOS) any parameter field allows you to select a variable. For example, you can choose the result of another action, such as the picture returned from a Take Photo action.

Returns

The file path of the saved file relative to the vault root.


Switches

Target folder

If you want to save the file in your vault's main folder, pick root folder. If you want so save it to a custom folder, select folder.


Parameter

File

Any file, be it a file coming from Finder or a new photo from Camera.


Options

Strategy for dealing with an existing file

The default behavior in case there’s already a file with the same name / at the requested file path, the base file name will be suffixed with a number. You can also choose to overwrite the file or skip the creation of a new, suffixed file (i.e., leaving it as it is).

Create Folders

When enabled, then the action will automatically create any necessary folder structure. If disabled, no folders will be created. Only available when using a custom target folder.


Examples

Take photo and store it together with a new note

Take a photo, then immediately store it as-is in your vault's root folder. Since the action returns the path of the saved file relative to the vault root, we can use its output in a Markdown embed without any changes. The returned text could then be used as the body of a new note in the same vault, and that note would show the photo.

Save a text as a new file

If you have a Text action and want to save its output as a new .txt file to your vault, it's enough to use the Text action output/result as the input parameter in "Save File":

Internally, Shortcuts passes results between actions as files already, or turns them into files on-the-fly. So the Text result will be treated as a file.

The same goes for other Shortcuts data structures, like Dictionary – internally, Shortcuts passes the dictionary between a workflow's actions in the form of a JSON object, and so it will be saved as such by "Save File":


Changes / History

v2024.1

  • Initial release.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Carlo Contact Carlo