Smartphone photo backup to server, sync new files, keep deleted

Hi,

I have a question regarding the following configuration:

I want to have all my photos on the smartphone (android) to be copied to a server for backup in such a way that I can safely delete them on smartphone (to clean up space) and keep everything on the server.

In other words, have a one-way sync of new files from smartphone to server, do not sync deleted files (if I delete from smartphone - do not delete on the server and vice versa).

Is it possible with Syncthing?

Currently not, see https://github.com/syncthing/syncthing/issues/62 tldr; Syncthing focuses on synchronizing folders and does not function as a backup service. However, in the future there might be something as a ā€˜backupā€™ flag.

For one way sync without deletes, you basically want a periodic rsync; Iā€™m sure there are tools out there that do this? Itā€™s a much simpler problem to solve than what syncthing does by default.

Iā€™ve read the discussion you have for issue 62 and see where the challenge is. Itā€™s a great tool (using it for my devices) and hope that one day you will add this feature. Thank you!

P.S. Will check rsync, didnā€™t try it for a while.

I used foldersync before btsync/syncthing to sync all my files between my homeserver and my Androids. I still use it for instant sync of DCIM when on mobile data. It can sync one way without deletion. It supports FTP,SFTP,Webdav,Owncloud,SMB (Windows Shares) and other server types. The free version can be used with one server (but multiple folders).

2 Likes

@wweich - Thanks for the tip about foldersync.

Iā€™ve been using MS OneDrive to do a 1 way cloud backup of my DCIM folder - but was thinking about replacing it with something offering more privacy.

Just installed foldersync on my phone, and easily configured a scheduled SFTP backup to a remote Linux server that I control. Terrific! Thank you.

I have a folder share like that. The only draw back is that ST suffixes them with delete dates because I have versioning enabled.

Set up a share, enable versioning on the end device and delete pictures from your phone. The photos will be versioned in the dot folder in the share folder on the pc.

Also v11 supposedly comes with a custom versioning option where removing is handled by scripts, that way you can move the stuff via a script but I have not tried it yet.

As a workaround to that (getting files renamed), the ā€œexternalā€ versioning scheme could be used. I havenā€™t actually tried it myself, but a script similar to this may work on Unixes at least:

#!/bin/sh

ARCHIVEDIR=/some/place/for/old/files
FOLDERPATH="$1" # this is the path to the folder
FILEPATH="$2" # this is the filename within the folder, that is going to be overwritten

FILEDIR="${FILEPATH%/*}"
mkdir -p "$ARCHIVEDIR/$FILEDIR"
mv "$FOLDERPATH/$FILEPATH" "$ARCHIVEDIR/$FILEPATH"

I just typed that into the forum right now, so itā€™s probably full of errors and will erase your files, but it may give someone an idea in the right direction.

On Windows thereā€™s probably some sort of powershellery or batfilery that can do the same thing. Or vbscript or whatever. :expressionless:

We could also skip the date stamping with ā€œsimple versioningā€ when the number of versions is set to one, or something like that.

Unfortunately external file versioning doesnā€™t exec script that I want to use. I have Windows, tried running powershell script:

C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe D:\sync_move_files.ps1

And regular bat files: cmd.exe sync_move_files.bat

Doesnā€™t work. In syncthing.log file there is a message: [ABUNC] 15:34:25 INFO: Puller (folder ā€œfolderā€, file ā€œfile.jpgā€): delete: exec: ā€œC:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe D:\sync_move_files.ps1ā€: file does not exist

Iā€™m able to run scripts with these commands, no issues, but it doesnā€™t work from Syncthing.

What am I doing wrong? Have the latest version installed (0.11.5 Win 64).

just try powershell d:\... given powershell is on PATH

I think it accepts only a single path to an executable, not a command with parameters. Is a .ps1 file not executable by itself in Windows?

Very true!

12345612356

Thanks, working with .bat files (self-executable in Windows). e.g. C:\test.bat