Newb: Finding images

Heres what im trying to do:

tell application “Finder”
if folder “PNGS” exists then
delete folder “PNGS”
end if
make new folder with properties {name:“PNGS”}
duplicate (every file whose file type = “.png”) to folder “PNGS”
end tell

but it doesn’t work and i can’t seem to find any way to do this…

Hi,

in many cases file type is an empty string.
Checking name extension might be better

...
duplicate (every file whose name extension is "png") to folder "PNGS"
...

Greetings, RyanAnger;

Your’re not specific enough with your instructions. if exists folder “PNGS” will only detect PNGs if it is on your desktop - the default location in which the Finder will look. Otherwise, you’ll have to specify a better path.

Next, the file type of a file with a png extension is PNGf. You can discover this like this:

tell application "Finder" to set T to file type of (choose file) -- chooose a file of interest

Also, (every file whose file type is “.png” [no such thing]) would refer to the desktop, since you didn’t specify a place to look.

Can you help us out - be more specific about your needs and situation