Newbie Question: Prevent files deletion in remote machine when we delete in host machine

Hello,

I use Syncthing to backup media from android to windows. I set folder as ‘send-only’ in android while on windows I set it as ‘receive-only’. The problem on my side is my phone storage almost full. The dumb-version-of me-before-today are just realized that if I delete files on my android, the same file on windows is gone :exploding_head:, such wow.

Now I’m looking a way to ‘safely’ delete files on my android device without affecting any files on windows, and also without triggering any error warning (out-of-sync, etc) on Syncthing app. After thinking using past experience and tinkering for a while, I came up with two solution.

  1. I can use file-versioning/trash-can. After deleting the file from Android device, and after Syncthing Windows done moving the file into .stversion folder, I can move ALL the file inside .stversion on other location. Pros: Useful if I do this in small batches. Cons: I have to actively monitoring and move the file inside .stversion folder; The impact is too big if I had to move a lot of files in windows that actively monitored by Syncthing app.

  2. I can nuke Syncthing folder config by ‘disconnecting’ the connection between Syncthing Android and Syncthing windows to prevent any change during the process, delete ALL files in android device, and then setting up new connection between Android and Windows device using ‘new’ location in windows device. Pros: The cleanliest way to do if the files is a lot. Cons: Need to create new folder configuration, prone to me making error while setting up new folder.

My question is, which way is better? Or there is a better way to do this inside Syncthing app? Thank you in advance,

Ideas :bulb:

  • manual → set folders to “send & receive” and on PC move files outside of sync folder
  • automatic → in addition to “media” (send / receive only) create second folder “archive” (send & receive) where you move files on phone if you need space. Make script on PC that moves files to final location

My setup for many years :handshake:
single “send only” folder on phone for backup to PC if space is low, move older files with USB cable to final location. This solution is approved by parents™ :older_woman: :older_man:

manual → set folders to “send & receive” and on PC move files outside of sync folder

CMIIW, Is altering any files on PC while the file is still exist in my android will trigger ‘Local Additions’ notification on Syncthing app? I’ve tried to move files from monitored folder to outside location, and now I have to live with that notification AND red big button that says ‘Revert local change’, instead ‘Up to Date’ which is… low-key… personally annoying lol.

I also think that this strategy will temporary double my disk usage/duplicate the file. Since sometimes I want my file to live in my phone longer, before decided to delete it. So it need to live in both monitored folder in PC and final archive folder.

automatic → in addition to “media” (send / receive only) create second folder “archive” (send & receive) where you move files on phone if you need space. Make script on PC that moves files to final location

Never cross my mind I can use script to move files. Maybe I can combine my file-versioning strategy with some script. I’m Gonna research more!

Thanks a lot for the idea!

I’d suggest to have a look at https://docs.syncthing.net/users/versioning.html#external-file-versioning. This way you could embed the script into Syncthing itself, without any need for running it externally.

I’d prefer the first solution here as well. Basically use Syncthing without any special settings. It does a two-way transfer, meaning new files created on Android get copied to the PC and stuff deleted (actually moved somewhere else) on the PC gets deleted on Android as well. Theoretically it will sync changes in the other direction as well, but you just don’t make any other changes.

The downside is that freeing space on the phone actually happens by moving files on the PC, not by deleting them from the phone. In my experience that’s not a problem though, as I tend to sort them into different directories for archive storage anyway. If you’re in desperate need to free space on the phone immediately without access to the PC, you could still just pause the folder, delete files, and move the same files once you get to the PC again, but before unpausing the folder.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.