I’m writing a script to inject the names of the files inside a folder into a custom metadata field of the tarball of that folder. I’m trying to filter out the hidden files in that list of file names. In terminal I can issue this command
But when I try to write that into an applescript I get errors with the ‘/.’ part of the command. I’m not sure how to handle this escaped character. Tried a few ways and can’t seem to crack it. My eventual script should like something like this.
do shell script "output='$(find " & (theFolderPath) & (quoted form of (name of theFolder as text)) & " -not -path '*/\.*' -type f -exec basename {} ';')' && xattr -w com.apple.metadata:Filenames '${output}' " & nameofTarbal
Problem is that files can be invisible even when they don’t start with a period so the System Events solution isn’t exactly the same. Think about folder like /Volumes, /usr and /etc you won’t see on your boot disk.
For all I know AppleScript doesn’t have an single command ready for this. AppleScript Toolbox does however: