-
Notifications
You must be signed in to change notification settings - Fork 32
Saving outside the Downloads folder
The WebExtension downloads API only lets an extension save into folders inside the browser's default download directory. Save In destinations are therefore relative paths under that directory. To make a destination land somewhere else, you redirect a subfolder of the download directory to another location — but which redirect works depends on your browser and operating system.
| Firefox | Chrome | Notes | |
|---|---|---|---|
| Change the default download folder | ✅ | ✅ | Simplest and safest |
| Real subfolder of the download dir | ✅ | ✅ | |
Directory symlink (ln -s, mklink /D) |
✅ follows it | ❌ rejected (download is interrupted) | |
Linux bind mount (mount --bind) |
✅ | ✅ | Needs root |
Windows junction (mklink /J) |
✅ | ✅ |
Chrome refuses to save through a symlink — it treats a symlinked
destination as unsafe and interrupts the download (USER_CANCELED). A real
directory, a junction, or a bind mount has no symlink reparse point, so Chrome
saves into it normally. Firefox happily follows a symlink.
The recommended fix on every OS is to change the default download folder. The link/mount tricks below are for people who understand the trade-offs — and Windows junctions in particular carry a real risk of data loss.
Change the browser's default download folder to a common parent, then let Save In file into real subfolders under it:
- Chrome: Settings → Downloads → Location.
- Firefox: Settings → General → Files and Applications → Downloads.
The only trade-off is that this moves the base folder for all downloads.
Create the redirect inside the download directory and use the relative name
(e.g. archive) as your Save In destination. The target folder must already
exist.
# Linux / macOS
ln -s /path/to/archive ~/Downloads/archive:: Windows (needs admin or Developer Mode)
mklink /D %USERPROFILE%\Downloads\archive D:\ArchiveA junction works with Chrome and mklink /J needs no admin — but junctions are
easy to turn into data loss, so prefer changing the default download folder.
The danger: a junction looks like a normal folder, so tools that recurse into folders treat it as the real thing.
-
Deleting the junction can delete the target's contents. Removing it with
rmdir /S, dragging it to the Recycle Bin, or some file managers follows the junction and wipes the linked folder — not just the link. - Backup, sync, and search indexers may follow it and duplicate the target, or propagate a deletion into it.
If you accept the risk:
mklink /J %USERPROFILE%\Downloads\archive D:\ArchiveRemove it only with rmdir (no /S) or fsutil reparsepoint delete %USERPROFILE%\Downloads\archive — never rmdir /S and never by deleting it in
Explorer, or you can lose everything in the target folder.
A bind mount presents the target as an ordinary directory. It needs root, and
should go in /etc/fstab to survive a reboot:
sudo mount --bind /path/to/archive ~/Downloads/archivemacOS has no simple directory redirect that Chrome accepts: a symlink is rejected, and a Finder alias is not a real link that the download API follows. Options:
- Change the default download folder (above), or
- Use an Automator Folder Action (or a Shortcuts automation) on the download folder that moves files elsewhere after they land, or
- Advanced: mount a real filesystem at the subfolder path (e.g.
bindfsvia macFUSE, or a mounted disk image).
- Hard links don't apply. A hard link can only name a file, never a directory, so it can't redirect a destination folder.
- The target directory must exist first, or the download fails.
- Paths containing
.., absolute paths, and hidden segments such as.privateare not accepted as destinations.
Behaviour above was verified against current Chrome and Firefox: Chrome interrupts a symlinked download and writes through a junction (Windows) and a bind mount (Linux); Firefox follows a symlink. Save In's CI re-checks this contract on Windows and Linux for both browsers.