Updated: Surgical Deletion Tool for Syncthing Encrypted Folders (Linux)

Updated from: Surgical Deletion Tool for Syncthing Encrypted Folders (Linux)

This script provides fine‑grained control over deleting files inside Syncthing’s encrypted folders (geared for .stversions, but can do any encrypted folder). Decrypts on the fly, allows which files to remove using pattern matching/filelist, check without action via dry‑run, uses confirmation prompts or automatic removals. Good for removal of large files/dirs, etc. after ignores are added (eg caches files, logs, junk files, etc.).

Use with caution and at own risk: use “-h/–help” for info, and “-n/–dry-run” to show what would be deleted, but do nothing.

Expanded pattern matching – added -s (substring), -g (glob), and kept -r (regex), while -m is now wildcard (not glob as before).

  • Multiple patterns – allows for any number of patterns across different types, combined with OR logic.
  • File input – any pattern argument can be prefixed with @ to read patterns from a file (one per line, # comments ignored).
  • Improved safety – if no patterns are given (and neither --all nor --list is used), the script exits with an error instead of prompting for every file.
  • Better list mode – lists files with sizes and both plaintext/encrypted names, instead of raw syncthing decrypt output.
  • Human‑readable sizes – added -H option to display sizes in KiB/MiB/GiB.
  • Other refinements – fixed wildcard‑to‑regex conversion, added directory cleanup after deletion, and improved usage/help text.

st-enc-prune.sh (11.7 KB)

1 Like