I am trying to use a one line Applescript to delete a file in a known directory - but I can't get it to recognize the directory: osascript -e 'tell application "Finder" to delete (files of entire contents of folder "/Folder1/folder2" whose name is "MyFile.txt")'
but I get the following error:
29:183: execution error: Finder got an error: Can’t get folder "/Folder1/folder2". (-1728)
I have also tried:
osascript -e 'tell application "Finder" to delete (files of entire contents of folder "folder2" of folder "Folder1" whose name is "MyFile.txt")'
But had similar results - it couldn't find Folder1
I want the script to work across computers, so I don't know what a disk name would be.
Does anyone have any suggestions?
Thanks in advance!