Before posting, and to avoid disappointment, please read the following:

  • This forum is not for 2BrightSparks to provide technical support. It's primarily for users to help other users. Do not expect 2BrightSparks to answer any question posted to this forum.
  • If you find a bug in any of our software, please submit a support ticket. It does not matter if you are using our freeware, a beta version or you haven't yet purchased the software. We want to know about any and all bugs so we can fix them as soon as possible. We usually need more information and details from you to reproduce bugs and that is better done via a support ticket and not this forum.

Sync only the latest file...

SyncBackFree is the freeware version of SyncBack. It is *not* an evaluation version of SyncBackPro/SE.
Post Reply
chrwei
Newbie
Newbie
Posts: 5
Joined: Thu Dec 02, 2021 4:18 pm

Sync only the latest file...

Post by chrwei »

I have a directory tree on a server of periodic database dumps. I occasionally mirror those to my PC for local restore for development. Only the newest file in each folder is needed for this.

Is there a way to do that with SyncBack? I'm not seeing anything obvious in the settings and filters.

What I'm doing now is Run Attended, sort by source date&time, and selecting the ones I don't want and setting the action to Skip. I'm looking for a way to automate this without having to write my own program.

I see Pro supports scripting, and I've reviewed the manual, and it's not clear to me that I can do this on Pro, so I'd like to know that too.
mmullins_98
Expert
Expert
Posts: 240
Joined: Wed Jun 05, 2019 11:40 am

Re: Sync only the latest file...

Post by mmullins_98 »

It sounds like what you want is exactly what the SYNC profile does in SyncBackFree.

Assuming the files you don't want to copy are on your PC in the same folders as the server then only the newest on the server will be copied. The sync goes both ways so if you have a file newer on your PC then it will copy to the server.
If you are using a MIRROR profile then it will want to copy everything regardless.

I may be missing something and if so then try to be a little more specific.
chrwei
Newbie
Newbie
Posts: 5
Joined: Thu Dec 02, 2021 4:18 pm

Re: Sync only the latest file...

Post by chrwei »

I don't want old local files pushed to the sever, and I only want certain new files pulled, and all other local deleted.

example source:
a/diff/a_diff_1.bk
a/diff/a_diff_2.bk
a/diff/a_diff_3.bk
a/full/a_full_1.bk
a/full/a_full_2.bk

there are also "b" and "c" versions of the same structure. the file timestamps will correlate with the numbers, so 1 is the oldest, and 3 the newest.

I want only a_full_2.bk and a_diff_3.bk brought local if they aren't already, and anything else local removed.
mmullins_98
Expert
Expert
Posts: 240
Joined: Wed Jun 05, 2019 11:40 am

Re: Sync only the latest file...

Post by mmullins_98 »

Then I suggest writing a script outside of SyncBack and set your profile to run it before running the profile that you want to sync or mirror.
chrwei
Newbie
Newbie
Posts: 5
Joined: Thu Dec 02, 2021 4:18 pm

Re: Sync only the latest file...

Post by chrwei »

Can SyncBack take a script output for the list of files to sync? I'm not seeing it. is that something the Pro can do? it's not clear from the documentation.

Otherwise what I think you're suggesting is that I write something that syncs using robocopy or something, which doesn't have the nice pause feature, and lack s a great overall progress indication, in which case I wouldn't need SyncBack at all.
mmullins_98
Expert
Expert
Posts: 240
Joined: Wed Jun 05, 2019 11:40 am

Re: Sync only the latest file...

Post by mmullins_98 »

Just put the output of your script into a folder that you want SyncBack to sync to a destination. The script can be run in the SyncBack profile with the "Programs - Before" option.
mmullins_98
Expert
Expert
Posts: 240
Joined: Wed Jun 05, 2019 11:40 am

Re: Sync only the latest file...

Post by mmullins_98 »

Use the script to rename, move or delete files to have the names the way you want them and put them in a folder to sync.
chrwei
Newbie
Newbie
Posts: 5
Joined: Thu Dec 02, 2021 4:18 pm

Re: Sync only the latest file...

Post by chrwei »

I'm doing this over a vpn, i don't have bandwidth for that This is the whole reason I'm using SyncBack in the first place
Sn3akyP3t3
Enthusiastic
Enthusiastic
Posts: 12
Joined: Fri Feb 18, 2022 8:41 pm

Re: Sync only the latest file...

Post by Sn3akyP3t3 »

I've been using SyncBack Pro for many years now and I was waiting for it to eventually evolve to provide some sort of user defined variables section that melded well with Python which then can drive functionality and override existing decision making. However, for whatever reason the scripting capabilities seem to be still buried deep with scripting languages that are not well known and/or the art is lost and not well documented.

Still, I think there's hope with a little effort on your part. I suggest the following:
  1. Since your files have a distinct unique name and a number sequence pattern you can use that to your benefit. Run a pre-processing script to get the names of the files you seek. I wrote this little program which will identify the files you seek and changes the modified timestamp so that SyncBack can easily identify them (https://gitlab.com/-/snippets/2258038). You have a choice of running the Python application on the machine where the *.bk files are located as a scheduled task or have SyncBack run it as a Before program. Pick your poison I guess and work out the details of syncing schedules if needed.
  2. Run SyncBack with the Compare Options -> Date Time -> Ignore Files that have not been modified in the past 10 minutes condition (tweak this to your liking)
The benefit of doing things this way is that your limited bandwidth problem is avoided because the files to move are tagged by newish modified timestamps making the files candidates to sync with SB.

There may be a way to do this with variables and Pascal scripting, but that's beyond my current advanced knowledge with SyncBack. Its not a very well documented area and seems like a throwback when compared to working with general programming languages like Python.
Post Reply