Hi All, I found an AppleScript to clean a USB of the dot files and safely eject it. Im trying to use it in an Automator app on my desktop. The one I found set the path to a picked folder from a window, but I just wanted to drag and drop the USB icon into the Automator App on my desktop. I keep getting this error and I’m not sure why as this was supposedly a working applescript. Can someone help please. Thank you in advance, Adown
sh:
if: command not found
sh: then
: command not found
Here’s the script and Im running OSX Sonoma:
set selectedVolume to (POSIX file "/Volumes")
set volumePath to POSIX path of selectedVolume
do shell script "
if [ -d '" & volumePath & "' ]; then
dot_clean -m '" & volumePath & "'
find '" & volumePath & "' \\( -name .DS_Store -o -name .apdisk \\) -type f -delete
rm -rf '" & volumePath & "'/{.Trashes,.Spotlight-V100,.fseventsd,.TemporaryItems}
diskutil eject '" & volumePath & "'
fi"
display dialog " Volume is clean and safe to unplug" buttons {"OK"}