Page 1 of 1
How to copy Tags & Comments from one location to another?
Posted: 17 Mar 2021 21:50
by chumbo
I have made a whole bunch of changes to where my files are stored due to an SSD failure.
I would like to now reapply the tags & comments I had stored for those files but to their new location.
So in the tag.dat file, it's very easy for me to find the tags&comments I'm interested in as they were all stored in one folder (I searched the folder name and I have 65 entries).
My plan was to simply replace in the tag.dat file, the path to those 65 entries with the new corrected one, then just restart XY.
Is that safe to do, will that work?
Just want to make sure in order not to irreparably mess up my tags!
Thanks!
Re: How to copy Tags & Comments from one location to another?
Posted: 17 Mar 2021 21:53
by highend
Maybe, maybe not. Depends if the tag.dat Data: section is sorted correctly afterwards
Re: How to copy Tags & Comments from one location to another?
Posted: 17 Mar 2021 22:14
by chumbo
Huh....ok. So, how do I make sure? What should I be careful about? Thx!
Is there a better way?
Re: How to copy Tags & Comments from one location to another?
Posted: 17 Mar 2021 22:44
by highend
Copy everything into the clipboard and run a sort script over it, paste it back?
copytext formatlist(<clp>, "ec", <crlf>);
Re: How to copy Tags & Comments from one location to another?
Posted: 18 Mar 2021 11:38
by chumbo
Let me make sure I get this right...
(I assume by clipboard, you mean the area in memory where copy/cut operations are stored, right?)
So I....
- copy all the tag.dat content to e.g. a text file
- make the changes as I described previously
- copy that, go to XY and run your script
- close XY, replace the content of the tag.dat with the clipboard
Correct?
Re: How to copy Tags & Comments from one location to another?
Posted: 18 Mar 2021 11:44
by highend
No.
you change the paths in the
data section of the tag.dat file, select everything (ofc in the data section again^^), CTRL + C, run the script, paste everything back into the data section, save the tag.dat file, restart XY WITHOUT saving settings now...
Or as a full script (you make the changes to your tag.dat before executing it!):
Code: Select all
$tagFile = "<xydata>\tag.dat";
$content = readfile($tagFile);
$header = gettoken($content, 1, "Data:<crlf>");
$data = gettoken($content, 2, "Data:<crlf>");
end (!$data), "No tag(s) / comment(s) found in the Data: part, aborted!";
$data = formatlist($data, "ec", <crlf>);
writefile($tagFile, $header . "Data:<crlf>" . $data, , "tu");
exit "nr";
or as a GUI way:
Configuration | Information | Tags | Options | Database Check...
2 x OK button inside the message requesters...
Re: How to copy Tags & Comments from one location to another?
Posted: 20 Mar 2021 23:20
by chumbo
(sorry, had been away from the PC for a few days...)
Awesome, thanks so much!
Really kind of you to have taken the time
The 2nd script did it for me
