The Save File action is used to both save and copy files. However, it will not copy a file from one drive to another when the Overwrite if File Exists option is enabled, and it doesn’t seem to matter if the source file actually exists in the target folder. For example,
The shortcut works with the overwrite option disabled. If the source file exists in the target folder, a duplicate with a counter is created.
There are a few workarounds, such as deleting an existing file in the target folder before doing the copy. I wondered if anyone has encountered this issue or found a better solution. Thanks!
BTW, the same behavior is observed with the Move File action, so perhaps this works as Apple wants it to.
The following is another workaround, and it seems a bit safer then deleting the existing file.
Copy File to External Drive with Overwrite.shortcut (22.5 KB)
I encountered this issue once again and didn’t understand the workaround. So, after figuring things out, I thought I’d try again.
I want to save/copy a file to a folder on an external drive and to overwrite the existing file. The path to the file on the external drive is:
/Volumes/Store/Save/Test.txt
The following dialog works and overwrites the existing file:
My explanation:
-
Test.txt is the source file, which can be on a boot or external drive.
-
Store is the parent folder of the parent folder of the target file (i.e.
/Volumes/Store/
).
-
/Save/Test.txt is the parent folder of the target file and the target file.
I assume this is a workaround, but perhaps this is how it’s intended to work. I don’t know why the Save
folder has to be part of the subpath instead of being included with Store (i.e. /Volumes/Store/Save/
) but that’s the only way it seems to work.
I think it’s a bug.
I ran a few combinations of boot vs. external drive, and filename vs. /path/filename, and this is what I came up with:
Save to: |
Boot Drive |
Boot Folder |
External Drive |
External Folder |
Subpath prefix: |
/Users/< name >/Desktop |
|
/test |
|
|
|
|
|
|
/file.txt |
X |
OK |
OK |
X |
/path/file.txt |
X |
OK |
OK |
X |
Save To: Boot Drive
100% failure rate. Note: Silent failure - no error, no warning, no file copied
Save To: Folder on Boot Drive
100% Success, regardless of whether Subpath includes subfolder name or not
Save To: External Drive
100% Success, regardless of whether Subpath includes subfolder name or not
Save To: External Folder:
100% Failure, with generic error message “There was a problem running the shortcut…”
So there’s, at the very least, an inconsistency. If the destination is on the boot drive, you MUST select a directory on that drive. You can optionally include a subdirectory of that nominated folder in the Subpath field.
However, this contrasts with external drives, where you can ONLY specify the drive and MUST include the destination directory path in the Subpath field.
Tested on MacOS 26.0
1 Like
Thanks Camelot. I hadn’t considered all those possibilities, but I think I understand them now.
The circumstance you note above is the one that causes the greatest issue for me. My workaround in post 3 works, but only if the target file is one folder deep. Thus it works with the first path below but not the second. I’ll have to give this some additional thought.
/Volumes/Store/Save/Test.txt
/Volumes/Store/Save/FolderTwo/Test.txt
Well, I did some additional testing and I agree with Camelot that this issue is probably just a bug that needs to be fixed.
I wondered if the approach of bifurcating the target into folder and subpath was a workable one, and I ran some tests with the Overwrite if File Exists option disabled. Everything seemed to work as I would expect, and a new file with a counter is created if the target file exists (which is how shortcuts generally handle duplicate files).
Source File:
/Users/robert/Working/Test.txt
THESE WORK
Target Folder:
/Volumes/Store/
Target Subpath:
/Save/SaveTwo/
Target Folder:
/Volumes/Store/
Target Subpath:
/Save/SaveTwo/Test.txt
Target Folder:
/Volumes/Store/Save/
Target Subpath:
/SaveTwo/
Target Folder:
/Volumes/Store/Save/
Target Subpath:
/SaveTwo/Test.txt
Target Folder:
/Volumes/Store/Save/SaveTwo/
Target Subpath:
[no value]
Target Folder:
/Volumes/Store/Save/SaveTwo/
Target Subpath:
/Test.txt
Target Folder:
/Volumes/Store/Save/SaveTwo/
Target Subpath:
/RenamedTest.txt
THIS DOESN’T WORK
Target Folder:
/Volumes/Store/Save/SaveTwo/Test.txt
Target Subpath:
[no value]
I ran into something like this overwriting a file in Dropbox. I settled on deleting the old file to be replaced, then copying the new file.
1 Like
I hadn’t actually tried this approach, so I edited a frequently-used shortcut to work this way. The shortcut worked as expected even several folders deep on an external drive.
There are two potential issues, though. The first is that the shortcut will report an error and stop if the file to be deleted doesn’t exist. I don’t know if this situation would arise in an actual shortcut. The second issue is that the shortcut might delete the existing file, but the Save File action might fail for some reason, leaving things unfinished. The default Delete Files action is to move the files to the trash, so the Delete Files action can be undone.
Anyways, this approach seems the best workaround.