Sync/Merge Tags, Labels and Comments (XY Database ↔ Alternate Data Stream)

Discuss and share scripts and script files...
Post Reply
Norn
Posts: 522
Joined: 24 Oct 2021 16:10

Sync/Merge Tags, Labels and Comments (XY Database ↔ Alternate Data Stream)

Post by Norn »

Note:
  • ADS is supported only on NTFS volumes. File operations performed with software that does not support ADS may result in ADS data loss.
  • Applications that support ADS include XYplorer, Windows Explorer, Directory Opus (disabled by default), GoodSync, WinRAR (with the relevant option enabled), FreeFileSync, and FastCopy (with AltStream enabled).
  • ADS support may vary between applications, and some operations may require additional settings. It is recommended to verify that ADS is preserved after important file operations.
This is a new thread for my Sync/Merge scripts. I don't actually use most of the scripts in the original scripts thread, so I've decided to start fresh.



Sync Tags, Labels and Comments <-> ADS (Alternate Data Stream) (NTFS Only)
Sync Tags, Labels and Comments ↔ ADS (Alternate Data Stream) (NTFS Only) (Merged) v0.7.xys
Sync Tags, Labels and Comments ↔ ADS (Alternate Data Stream) (NTFS Only) v0.7.xys


Required XYplorer settings for the following scripts:
  • Enable: Configuration | Information | Tags | Auto-refresh tags
  • Disable: Configuration | General | Startup & Exit | Save Settings | Save changes to disk immediately | Tags
Backup dirty tags, labels and comments, To -> CEA-After browsing a folder
Dirty Tags Backup v0.3 (To CEA - After browsing a folder).xys
Dirty Tags Backup v0.3 (To CEA - After browsing a folder, Append Mode).xys
To -> Configuration | General | Custom Event Actions | Other Events | Exit
Sync Dirty Tags to ADS (To CEA - Exit) v0.3.xys
Sync Dirty Tags to ADS (To CEA - Exit) Merge Tags &amp; ADS v0.3.xys
To see the attached files, you need to log into the forum.
Windows 11 24H2 @100% 2560x1440

Norn
Posts: 522
Joined: 24 Oct 2021 16:10

Re: Sync/Merge Tags, Labels and Comments (XY Database ↔ Alternate Data Stream)

Post by Norn »

Read Dirty Tags File and Reapply Tags as Dirty
Read Dirty Tags File and Reapply Tags as Dirty v0.3.txt


Custom column: ADS Tags (Item type: Files and Folders):

Code: Select all

//Function : Custom Column: ADS Tags (Files and Folders) 2022-07-28 (Ken)
//Version  : v1.2 (2022-07-29)

	if (exists("<cc_item>:Tags")) {               // Check whether ADS exists
		$data = readfile("<cc_item>:Tags");       // Read ADS tags
		return gettoken($data, 1, "<crlf>");      // Return the first line
	}

Related Script:
Merge Tags, Labels and Comments from Duplicate Items into the Target Item (Including ADS)
To see the attached files, you need to log into the forum.
Windows 11 24H2 @100% 2560x1440

mackem
Posts: 14
Joined: 20 Aug 2021 18:24

Re: Sync/Merge Tags, Labels and Comments (XY Database ↔ Alternate Data Stream)

Post by mackem »

Apologies in advance because I'm going to sound immensely dim - but can you explain how to make this work?

I use Goodsynch to synchronise folders across drives, and want to copy comments alongside the files. If I understand correctly this script will facilitate that, but try as I might I can't get it to work. Have I got the wrong end of the stick? Any help gratefully received

ps - what is a "dirty tag"

Norn
Posts: 522
Joined: 24 Oct 2021 16:10

Re: Sync/Merge Tags, Labels and Comments (XY Database ↔ Alternate Data Stream)

Post by Norn »

Hi!

For LAN synchronization, I recommend FreeFileSync or FastCopy (enable AltStream). GoodSync does not copy ADS over a local network.
However, these tools don't seem to synchronize ADS when the destination file already exists, so I wrote an AutoHotkey script to synchronize ADS separately.

To create an "ADS Comment" custom column, enter ::snippet in the address bar and press Enter. Paste the following text and click OK:

Code: Select all

Snip: CustomColumn 1
  XYplorer 27.20.1609, 2026/11/25 22:24:23
Action
  ConfigureColumn
Caption
  ADS Comment
Type
  3
Definition
  	if (exists("<cc_item>:Tags")) {           // Check whether ADS exists
  		$data = readfile("<cc_item>:Tags");   // Read ADS tags
  		return trim(gettoken($data, 3, "<crlf>"), ";", "L");   // Return the third line
  	}
Format
  0
Trigger
  0
Item Type
  2
Item Filter
You can also use the first script to sync Tags, Labels and Comments from ADS back to XYplorer's tag database.

As for dirty tags, they are tag changes that haven't yet been saved to XYplorer's tag database.
Windows 11 24H2 @100% 2560x1440

mackem
Posts: 14
Joined: 20 Aug 2021 18:24

Re: Sync/Merge Tags, Labels and Comments (XY Database ↔ Alternate Data Stream)

Post by mackem »

Thanks Norn for such a speedy and detailed reply - still not sure I entirely get it but I'm going to spend time this weekend working through and I'm sure I'll get there in the end
Thanks for all that you do

Post Reply