Question

I had a SMB share from my NAS (based on illumos aka OpenSolaris, I used the kernel CIFS) and now I installed Netatalk for better performances.

The metadata apparently cannot be read back, that means that I lost custom folder icons (not many, already solved) and finder labels ("tags" in Mavericks). I am trying to use AppleScript to set them back.

I have the same shares mounted at the same time, from a UNIX point of view they are:

/Volumes/share
/Volumes/share-1

depending on which one I mounted first. On the desktop they appear with the same name (and same icon, shame on Apple this time).

I tried AppleScript:

display dialog "Select SMB share/folder"
set SMBshare to choose folder
display dialog "Select equivalent AFP share/folder"
set AFPshare to choose folder

but I get for both "share:Selected folder". As consequence, I cannot go on with:

set theLabel to label index of SMBshare
if theLabel is not 0 then
    [do some search/replace to get new path and set label index]
end if

So, how could I avoid the issue and transfer the labels from one share to another?

The only idea left is to mount the SMB share, then obtain the full list of files using

set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ", "}
tell application "Finder" to set MyList to (entire contents of (choose folder)) as text
set AppleScript's text item delimiters to TempTID

and then unmount the SMB share, mount the AFP share, reapply all the labels previously saved.

Update

I tried the method of mounting/unmounting and it works, but only on small folders or shares, on bigger ones the "get entire contents" takes too long and there is a timeout.

Was it helpful?

Solution

You could use a shell script instead of AppleScript. A tool like this can list and change tags on files.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top