applescripthideshowhiddentell

Hiding and Unhiding Individual Files Using Applescript


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.


Solution

  • 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\""