Stores a file in a vault via the file system (not the Obsidian API).
Returns the path of the new file relative to the vault root.
Parameters
Vault
The vault to work in.
Type: Vault reference
File
The file to save to the fault. Could be a picture, a PDF, a video, whatever.
Type: Dictionary
Destination 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
.
Custom folders won’t be created automatically unless Create Folders is enabled.
Options:
- root folder
- folder
Folder Path
Where to save the file. If an input file is named example.jpg
, then these example folder paths would yield these destination files:
- none/empty →
/example.jpg
abc
or/abc
→/abc/example.jpg
/a/b/c
→/a/b/c/example.jpg
Folders won’t be created automatically unless Create Folders is enabled.
Type: Text
Strategy for dealing with an existing file
If a file with the same name already exists at the specified location, what should the action do?
- Create new file with suffix: Adds a random suffix to the name of the file, e.g.
example.jpg
would be saved asexample-91ae8b2b.jpg
- Overwrite existing file: Replaces the old file with the input file
- Leave existing file as-is: Do not save the new file
Options:
- Create new file with suffix
- Overwrite existing file
- Leave existing file as-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 destination folder.
Type: Boolean (YES
/NO
)
Return Value
Text
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.
![](/_astro/afo-save-file-1.DtRJyZrv_Z1RGhCh.webp)
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”:
![](/_astro/afo-save-file-2.05KtyM3X_nRaPi.webp)
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”:
![](/_astro/afo-save-file-3.BCpVhyKr_C6CDc.webp)
Related Links
- Search the Actions for Obsidian community forum for "Save File"