I'm new to the art of scripting and am trying to learn with help file and forum posts. I manage to resolve a number of problems, but get nowhere with the following:
I want to synchronize directories between different external hard drives. Concretely, I have a Photo directory on G:\ with several levels of subdirectories. I have exactly the same structure on H:\ and Q:\.
G:\ serves as a reference i.e. I make the modifications and synchronize on H:\ and Q:\. I use the sync() function
There are just under 4TB of photos.
I cannot copy the tags from G:\ to the other disks, unless I overwrite everything, which is impossible, even by proceeding under level 2 sub-directories by level 2 sub-directories for example.
Is there any solution to this problem ? I've been searching for a while and can't seem to find an answer, although I think the question has probably been asked before.
The ideal would obviously be to only copy the new tags
I hope my message is, if not very clear, at least understandable.
Thank you for your help
Google translation
syn () function ant tag
Re: syn () function ant tag
Then write a script that copies only the tags?
Code: Select all
$srcPath = "G:\photos";
$dstPaths = "H:\photos|Q:\photos";
$srcDrive = gpc($srcPath, "drive");
$files = quicksearch("/t", $srcPath);
end (!$files), "No tagged file(s) found, aborted!";
foreach($file, $files, <crlf>, "e") {
$srcTags = tagitems("tags", , $file);
$dstPath1 = gettoken($dstPaths, 1, "|");
$dstPath2 = gettoken($dstPaths, 2, "|");
$newFile = replace($file, $srcDrive . ":", gpc($dstPath1, "drive") . ":");
if (exists($newFile) == 1) {
$dstTags = tagitems("tags", , $newFile);
if ($srcTags != $dstTags) { tagitems("tags", $srcTags, $newFile); }
}
$newFile = replace($file, $srcDrive . ":", gpc($dstPath2, "drive") . ":");
if (exists($newFile) == 1) {
$dstTags = tagitems("tags", , $newFile);
if ($srcTags != $dstTags) { tagitems("tags", $srcTags, $newFile); }
}
}
e "Done!";
One of my scripts helped you out? Please donate via Paypal
Re: syn () function ant tag
Thank you - I'm going to try this and see how it's done to learn a little more 
Re: sync () function and tag
If your main aim is backing up all the the tags/lbl/cmt/ex, I'd suggest just exporting the tags into the root folder first before the sync operation, then all the tags are in 1 file and backed up in the same sync command. Check out SC tagexport.
Also FYI if you use the script posted, be aware that in its current state, it is copying "tags" only.
Also FYI if you use the script posted, be aware that in its current state, it is copying "tags" only.
XYplorer Beta Club