3

I have written a very basic script to count the number of files in a folder, then if it reaches 16 files, to run an automator workflow, as below:

    #!/bin/bash 
    cd /Users/barbooths/Projects/Originals
    count=$(ls | wc -l)
    if [ $count = 16 ]
    then
        /usr/bin/automator /Users/barbooths/Projects/BatchRename.workflow
    else
        echo $count
  fi

However when I run the shell script in terminal, it seems to run the workflow with no problem, but it throws up a load of errors:

Bars-MacBook-Pro:Projects barbooths$ ./Foldercount.sh

2019-01-15 23:35:53.636 automator[4301:378917] Cache location entry for /Applications/Photos.app in cache file at /Users/barbooths/Library/Caches/com.apple.automator.actionCache-bundleLocations.plist is not valid: (null)
2019-01-15 23:35:53.636 automator[4301:378917] Cache location entry for /System/Library/CoreServices/Applications/System Image Utility.app in cache file at /Users/barbooths/Library/Caches/com.apple.automator.actionCache-bundleLocations.plist is not valid: Location /System/Library/CoreServices/Applications/System Image Utility.app has been modified.

I don't know a huge amount about scripting, so was wondering if anyone could point me in the right direction?

1

I'm not sure what causes the modification/corruption, but my solution has been to delete the specified files, in your case:

/Users/barbooths/Library/Caches/com.apple.automator.actionCache-bundleLocations.plist

Doing this eliminates the warnings for me (I was getting automator, photos, system image utility and a few others.

My automator scripts still run correctly from the terminal, they just do without the extra warning output.

  • My .plist file keeps coming back after a minute or two and I continue to get the same errors. – StevieD May 4 at 15:39
  • Do you keep editing the automator script? I was able to find a way to do my scripting with AppleScript, which seems more robust than automator, as I was constantly tweaking my automator flows for each OS update. – sidekickr May 6 at 2:30
  • It may have been open, I don't remember now. I did the same thing and stopped using Automator and just wrote my script in pure AppleScript. – StevieD May 6 at 7:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .