It seems that “supposed” is the important word.
If I run the script with the syntax proposed in your message:
set allAliasFiles to paragraphs of (do shell script "mdfind \"kMDItemKind == 'Alias'\"")
set {TID, text item delimiters} to {text item delimiters, "' '"}
set aliasFilePaths to "'" & (allAliasFiles as text) & "'"
set text item delimiters to TID
set brokenAliases to do shell script "/Users/admin/bin/AliasPath -b " & aliasFilePaths
set fileDescriptor to open for access ((path to desktop as text) & "FinderBrokenAliasesLast.txt") with write permission
write brokenAliases to fileDescriptor
close access fileDescriptor
I get the error :
error "sh: -c: line 0: syntax error near unexpected token (' sh: -c: line 0:
/Users/admin/bin/AliasPath -b ‘/Users/???/Library/Speech/Speakable Items/Application Speakable Items/Safari/Target Application Alias’ ‘/Library/Fonts/Monospaced ƒ/Andale Mono.ttf’ ‘/Library/Fonts/disabled ƒ/Cursives/SchoolHouse Cursive B.dfont’ ‘/Library/Fonts/disabled ƒ/Cursives/Santa Fe LET Fonts.dfont’ ‘/Applications/Adobe Acrobat DC/Acrobat Uninstaller’ ‘/Users/???/Downloads/Developer/Tools’ ‘/Users/???/Downloads/Developer/Documentation/DocSets’ ‘/Users/???/Downloads/Developer/Library/Xcode/Xcode’ ‘/Users/???/Downloads/Developer/Library/Xcode/PrivateFrameworks’ ‘/Users/???/Downloads/Developer/Library/Xcode/Frameworks’ ‘/Users/???/Downloads/Developer/Platforms/MacOSX.platform’ …
I’m not too surprising by the issued error because as you may see, the path to broken aliases may contain space or “ƒ” characters and, but you can’t see that, they may also contain characters like “…”, “œ”,“é” and some other non ASCII ones.
Trying to get rid of that, I edited the shell instruction as :
set brokenAliases to do shell script "/Users/admin/bin/AliasPath -b " & quoted form of aliasFilePaths
Alas, I got :
path to desktop as text
→ “SSD 500:Users:???”
open for access “SSD 500:Users:???FinderBrokenAliasesLast.txt” with write permission
→ 114
write “” to 114
close access 114
Yes, write nothing.
As the script doesn’t set EOF to 0 before writing, it doesn’t change an existing file.
This is why, yesterdays I retrieved the list of broken aliases in the file.
To get rid of that, I added one instruction:
set eof of fileDescriptor to 0
before the write one.
As I can’t post a screenshot I added instructions checking the availability of the CLI in the named folder.
Here is the relevant part of the history:
/Volumes/Macintosh HD/Developer/Library/Frameworks/CPlusTest.framework
/Volumes/Macintosh HD/Developer/Library/PrivateFrameworks/IDEBundleInjection.framework"
end tell
tell application "System Events"
exists file "/Users/admin/bin/AliasPath"
--> true
(*true*)
end tell
tell current application
do shell script "/Users/admin/bin/AliasPath -b ''\\''/Users/
As some paths may look surprising, I repeat that I don’t boot from “Macintosh HD” but from an external SSD.
Macintosh HD (mechanical HD) contain a replica of the SSD used as a backup.
Booting from the SSD fasten everything.
Yvan KOENIG running Sierra 10.12.6 in French (VALLAURIS, France) mercredi 26 juillet 2017 11:19:25