Page 2 of 3
Re: Sync folders questions
Posted: 22 Jan 2024 04:21
by Schuller
Will look into that but yeah, scripting and coding is way over my head, so if I go that route, I will definitely need assistance with it. Its the ability to hit a user button right in my toolbar that draws me to want to use XY instead. Perhaps if I map out my backup/sync plan, someone can assist me with a script and I can take it from there. Right now I'm using the Autosync app on my Android to sync files on a schedule with my PC then ViceVersa with different profiles to Sync further to backup drives and shared drives with some other people. I take lots of photos and videos of construction projects, inspections and more, so my phone is like an information vacuum sending that information off to the my PC. I had some ideas in mind also for batch renames and more once those phone files reach the PC but will have to take this slow due my limited knowledge on this stuff.
Thanks for getting back
Re: Sync folders questions
Posted: 23 Jan 2024 04:13
by Schuller
I want to hit the user button only once and I don't want to see this screen each time...

- by pass completely the overwrite if newer.jpg (138.41 KiB) Viewed 2152 times
What should I do in my script so that it just automatically selects OK for "Overwrite if newer" on name collisions and auto selects "Do this also for the next name collisions" ?
and please tell me what this means and if its necessary....

- help menu.jpg (608.33 KiB) Viewed 2152 times
I looked in the help file around the sync section and could not find when to use 5:= and when to use 7:= (or maybe I missed it)
Thanks
Re: Sync folders questions
Posted: 23 Jan 2024 04:46
by jupe
Look at the actual scripting definition line eg:
Code: Select all
sync source, target, [copy_items], [on_collision], [delete_items], [switches], [logfile], [filter]
so for example
sync "C:\My Documents", "D:\My Documents", , 0;
Ignore those 5/7 numbers, just get the basics right for now, those are the number of the argument, but they aren't necessary, as can be seen in the 4th example in your screenshot. (ie 5 would be [switches] 7 would be [filter])
Re: Sync folders questions
Posted: 23 Jan 2024 04:59
by Schuller
Here is what I have...
sync "C:\SCANSNAP", "S:\SCANSNAP(test)", 7:="-\Note20\Music\" | "-\Note20\Audiobooks\";
sync "R:\MY DOCUMENTS", "S:\MY DOCUMENTS(test)", 0, 0, 4, "k";
I still get the name collision dialogue box but everything else is fine (once i select overwrite if newer and also on next collision)
Re: Sync folders questions
Posted: 23 Jan 2024 05:02
by jupe
You have 2 sync cmds there, the first one you haven't disabled the dialog, so you would need something like this:
Code: Select all
sync "C:\SCANSNAP", "S:\SCANSNAP(test)", , 0, 7:="-\Note20\Music\|-\Note20\Audiobooks\";
sync "R:\MY DOCUMENTS", "S:\MY DOCUMENTS(test)", 0, 0, 4, "k";
Note that on the second line you've set it to not copy_items to target.
Re: Sync folders questions
Posted: 23 Jan 2024 06:00
by Schuller
Works Perfect!. I think I see what I did wrong and corrected that already and changed the copy item to 1
So every separate line for each source and target can have its own set of parameters.
Did a few test runs and this is working great so far. Its just the group of 20tb hard drives that slows things down but the SSD's are very fast and highend is correct that the initial copy will be slow but after things will be fast. Unfortunately in my case though, probably a few days just to copy.
Anyway, tried the open throw away clone too and ran another sync operation from there from my scripted button and I can work with my main instance now while things are copying.
So here comes the nitpicking, is there anyway to apply some sort of script to my existing script so that I can remain working in my main instance without having to do the open throw away clone? Like hit one button and done..and back to working in XY right away?
Re: Sync folders questions
Posted: 23 Jan 2024 06:16
by jupe
Yes of course there is, as I alluded to earlier. You can script XY to launch a new instance using the scripting cmd run, and start XY with the /script= command line switch to send the sync script you have written, and maybe add an exit cmd at the end of it if necessary. The command line switches are documented in the help file, as is the scripting cmd run
Re: Sync folders questions
Posted: 23 Jan 2024 07:50
by Schuller
Okay, will look into that.
Thanks!
Re: Sync folders questions
Posted: 23 Jan 2024 10:18
by Schuller
Is there anything I can add to this script that will add the date and time of sync at the end of the name of the top level folder each time a sync occurs?
Re: Sync folders questions
Posted: 23 Jan 2024 23:46
by jupe
If you take the time to look at the examples in your screenshot of the help file, a couple of them demo how to do this. If you need to know the chars to use for time, lookup the <date> variable in the Advanced Topics\Variables section of the help file.
Re: Sync folders questions
Posted: 24 Jan 2024 00:36
by Schuller
Okay, I experimented already with some of that but had no success yet and I literally took a month off work just to figure out some of the XY settings, so its back burner for now I guess until more time permits.
Thanks for getting back.
Re: Sync folders questions
Posted: 24 Jan 2024 00:54
by jupe
So this example was no help to you?
Code: Select all
// creates a new target folder every new day:
sync "E:\XY\code\", "F:\bup\XY-code-<date yyyy>\<date yyyymmdd>\", 1, 0, 0, "ckn";
So in your case it would be something like this (after looking up the date variable in the help):
sync "R:\MY DOCUMENTS", "S:\MY DOCUMENTS-<date yyyymmdd_hhnnss>", 1, 0, 4, "kn";
Re: Sync folders questions
Posted: 24 Jan 2024 04:01
by Schuller
// creates a new target folder every new day:
That's when I stopped reading further. Its probably the way I translate English to English.
That example you sent me I'm already using successfully in another back up job where I need a new dated backup copy everyday and I got it on the forum somewhere, and to be honest, while I do reference the 866 page help file, much of what I have learned so far about XY has come from the forum.
Anyway, here is a just one of my source/target lines in my multi-source/target script and its working well now..(for the others reading this)
sync "C:\SCANSNAP", "T:\SCANSNAP(Target)(1of1) Synced on <date yyyy.mm.dd @ hh.nnam/pm>", 1, 0, 2, "kn", 7:="-\Note20\Music\" | "-\Note20\Audiobooks\";
Also, a good thing I noticed with a sync/backup in XY over ViceVersa is that XY preserves/copies over my tags & comments and I like that.
I think I can run with this bit of knowledge for now Jupe and will get into that other scripting part of not needing the Throw Away Clone later.
Thanks for all your assistance on this.
Re: Sync folders questions
Posted: 24 Jan 2024 22:17
by Schuller
So after several hours now of running the initial copy/backup/source to target/one-way sync, it gives me the target folder named on my backup drive just as I had asked for with the date included at the end. Now again, the second time around, I run the same script and what I expected to be a sync only this time within that same last dated folder and expected only that top level folder name to change to reflect the most recent sync date, it gives me another backup copy dated again in a new folder and copies everything over again. A Backup!
"that will add the date and time of sync at the end of the name of the top level folder each time a sync occurs?"
So now I got 2 full dated copies but I only want one source to target sync at all times with the exception of the top level folder name change on each subsequent sync after the initial.
What I was asking assistance for earlier was only the top level folder name to change to reflect the last sync date and the contents within to be over written if newer and not a new folder created each time I run the script.
If this is not possible then I'll just remove the date from the previous script so the sync operation recognizes the folder.
Re: Sync folders questions
Posted: 24 Jan 2024 22:25
by highend
So now I got 2 full dated copies but I only want one source to target sync at all times with the exception of the top level folder name change on each subsequent sync after the initial.
And that is the expected result if you use a new target folder name^^
You'd need to check the existing folders in the dst root, take the one with the latest date, feed that as the new target for the sync command and when the sync is done, rename that folder again to the latest synced date...
Or you make it much easier (scripting wise) to just sync to always the same folder (without appending a date) and create a .txt file in that root dst with the name of the last sync date (and delete all other .txt files there that have the same leading part (e.g.
SNAPSCAN*.txt)...
E.g.:
Code: Select all
$dst = "T:";
$lead = "SCANSNAP";
$date = <date yyyy.mm.dd @ hh.nnam/pm>;
$txt = quicksearch($lead . "*.txt /n", $dst, "|");
if ($txt) { delete 1, 0, $txt; }
sync "C:\$lead", "$dst\$lead(Target)(1of1)", 1, 0, 2, "kn", 7:="-\Note20\Music\" | "-\Note20\Audiobooks\";
new("$dst\$lead Synced on $date.txt");