I have the following terminal command that I want to automate using applescript. I also would like to have a command to cd directories to the folder where I want to apply the command first. After cd to the folder that holds the .pdf files. This code looks at the first letter of the file name and based on that sorts the files into the alphabet folder corresponding to the first letter of the file.
for x in `ls -1 | sed -e 's/^\(.\).*/\1/' | sort -u`; do
mv -i ${x}?* $x
done
How would I go about doing this? I'm a newbie to this. Any insight would be greatly appreciated. I'm willing to learn Applescript, however, I'm not sure where to start to implement this.
Thanks