I am pretty new to scripting and i was wondering if anyone could help me out.
Here is the situation. I am trying to make an action folder that when an image is saved to it, the image is automatically moved to a folder based upon the first 4 or 5 integers of the name.
image names come in a few variations for example:
1000.jpg
10000.jpg
10000-v1.jpg
10000-v1 copy.jpg
any of the first 4 or 5 integers can be from 0-9.
this is the code i came up with so far.
tell application "Finder"
do shell script " if [ -f ~/Desktop/filing/1[0-9][0-9][0-9][!0-9]*.jpg ]
then
scp ~/Desktop/filing/1[0-9][0-9][0-9][!0-9]*.jpg ~/Desktop/filed/1000/
fi"
do shell script "if [ -f ~/Desktop/filing/1[0-9][0-9][0-9][0-9][!0-9]*.jpg ]
then
scp ~/Desktop/filing/1[0-9][0-9][0-9][0-9][!0-9]*.jpg ~/Desktop/filed/13000/
fi"
end tell
the trouble with this code is the wildcard [!0-9] wont work if the image is just 1000.jpg or 10000.jpg as having the [!0-9] means that it is excluding 0-9 range but expecting a character of some sort.
Anyway if anyone could shed some light on a solution to this that would be great.
Kai