I often have tag groups that look like this:
I thought it might be interesting to have an intersection of the two tag groups for browsing and exploration for a result like this:
This little script creates a new directory structure of the intersection of the two tag groups. The files are replicants so the structure is easily deleted or recreated.
tell application id "DNtp"
set theResult to display dialog "Enter the names of two tag groups separated by a semi colon:" default answer "" with title "Tree builder"
set oTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to ";"
set theResult to every text item of text returned of theResult
set AppleScript's text item delimiters to oTIDs
set firstGroup to children of (create location "/Tags/" & item 1 of theResult)
set secondGroup to children of (create location "/Tags/" & item 2 of theResult)
repeat with theFirst in firstGroup
set firstname to name of theFirst as string
repeat with theSecond in secondGroup
set secondName to name of theSecond as string
set theFiles to lookup records with tags {item 1 of theResult, item 2 of theResult, firstname, secondName}
if theFiles is not {} then
set theLocation to create location item 1 of theResult & " of " & item 2 of theResult & "/" & name of theFirst & "/" & name of theSecond
repeat with theFile in theFiles
replicate record theFile to theLocation
end repeat
end if
end repeat
end repeat
end tell