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?
Best Answer
I'm not sure what causes the modification/corruption, but my solution has been to delete the specified files, in your case:
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.