0

I have a simple automator app that runs a python script on the file that is dropped on it. However, I need to also extract the name of the dropped file so that I can use it to create a directory name.

for f in "$@"
do
    set myFileName to name of (item f of $@)
    /usr/local/bin/python3 /Volumes/Scripts/script.py "$f"
    mkdir myFileName (without extension?)
done
1

The first line of your script is Applescript whereas it should be shell (bash by default). The tersest version I can think of:

for f in "$@"
do
    /usr/local/bin/python3 /Volumes/Scripts/script.py "$f"
    mkdir ${f%.*}
done

You must log in to answer this question.

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