Sync folders questions
Re: Sync folders questions
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
Thanks for getting back
Re: Sync folders questions
I want to hit the user button only once and I don't want to see this screen each time...
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....
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
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....
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
Look at the actual scripting definition line eg:
so for example
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])
Code: Select all
sync source, target, [copy_items], [on_collision], [delete_items], [switches], [logfile], [filter] 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
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)
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)
Last edited by Schuller on 23 Jan 2024 05:02, edited 1 time in total.
Re: Sync folders questions
You have 2 sync cmds there, the first one you haven't disabled the dialog, so you would need something like this:
Note that on the second line you've set it to not copy_items to target.
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";
Re: Sync folders questions
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?
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
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 runRe: Sync folders questions
Okay, will look into that.
Thanks!
Thanks!
Re: Sync folders questions
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
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
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.
Thanks for getting back.
Last edited by Schuller on 24 Jan 2024 01:04, edited 1 time in total.
Re: Sync folders questions
So this example was no help to you?
So in your case it would be something like this (after looking up the date variable in the help):
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"; sync "R:\MY DOCUMENTS", "S:\MY DOCUMENTS-<date yyyymmdd_hhnnss>", 1, 0, 4, "kn";Re: Sync folders questions
That's when I stopped reading further. Its probably the way I translate English to English.// creates a new target folder every new day:
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
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.
"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
And that is the expected result if you use a new target folder name^^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.
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");
One of my scripts helped you out? Please donate via Paypal
XYplorer Beta Club