Hiding and Unhiding Individual Files Using Applescript

229 Views Asked by At

I need to write an applescript to hide and unhide specific files. This is what I have so far, but apparently the spaces in the file name is causing problems.

tell application "System Events"
    do shell script "chflags nohidden "/VOLUMES/Works/who/3130026 - Why Onspots.pdf""
end tell

Not sure what I'm doing wrong. Thanks in advance for the help.

1

There are 1 best solutions below

1
On BEST ANSWER

You need to escape the quotes inside the shell command, using the backslash '\' character, like so

do shell script "chflags nohidden \"/VOLUMES/Works/who/3130026 - Why Onspots.pdf\""