ignore case

Newbie question!
I am trying to do a simple clean up script on a folder but I am running into two problems. Here is what I am doing I have a folder that has a combination of jpegs and text files and need a script to extract them and put them into separate folders. Here are the two issues I am having.

  1. the script works fine on all lover case “.jpg” but when it is in upper case “.JPG” it skips them. I have read about Consider and Ignore statements but have not got it to work in my script.

  2. If no jpeg files exist (*.jpg) the script stops there and does not finish the rest of the actions. I don’t know where to begin there do I need to do “repeat from i to…” ?

Any help would be great.
Kerry

Hi,

By default AppleScript ignores case, so it’s something in your script. Here’s an example:

set main_folder to (choose folder) – the folder with mixed files
tell application “Finder”
move (every file of main_folder whose name ends with “.jpg”) to folder “JPEG Folder” of desktop
end tell

or this should work:

set main_folder to (choose folder) – the folder with mixed files
tell application “Finder”
move (every file of main_folder whose name extension is “jpg”) to folder “JPEG Folder” of desktop
end tell

where the user chooses the main folder and the jpegs are moved to a folder named “JPEG Folder” which is on the desktop. You might want to check for errors if no jpegs exists.

gl,

Thanks for the help but in my haste I left out that this script is running on a webserver so the owner of the files is “www” and I am using "do shell script which looks something like…

do shell script “mv -f path/to/file/*.txt /path/to/new/destination/” password “password” with administration privileges

I may be approaching this in the wrong direction though.

Thanks
Kerry