How to batch rename files by type

I don’t know why I’m having such a hard time figuring this out but I’m trying to figure out a way to simply rename every image file (.jpg) in a directory and its subcontents to Preview.jpg (For use with Front Row on Leopard)
I currently have a folder that contains about 200 VIDEO_TS folders and each VIDEO_TS folder has one .jpg file with cover art in it and all I want to do is change each one of these to Preview.jpg. Currently they have various names. I’ve tried the automator but can’t seem to get a wildcard match since you need a source text and this will vary per file. I checked out Rename4Mac and A Better Finder Rename but they can’t filter by type.
Maybe this is a more complicated issue than I see it but if someone could give me a hand that would be appreciated. I have done some basic Applescripts in the past but not enough to know what to do about this.

This should do it… When you run the script just select the folder that contains all your VIDEO_TS folders and off you go!

set sourceFolder to (choose folder) as string
tell application "Finder" to set name of files of entire contents of folder sourceFolder whose name extension is "jpg" to "Preview.jpg"
display dialog "Rename Complete"

Of course I would make sure you have a back-up first :smiley:

Thanks for the quick response
I just an that scriptlet on a sample folder and it worked. I figured there had to be an easy way to do that.
Thanks a bunch. I was going to start renaming them manually when I got home today!

Not for wannabe, I agree, but this would be a ton faster for finding them:

set tjpgs to paragraphs of (do shell script "mdfind -onlyin " & quoted form of POSIX path of (choose folder) & " 'kMDItemContentType == \"public.jpeg\"'")

[Couldn’t resist using MDfind :rolleyes::-)]

LOL, why am I not surprised Adam :stuck_out_tongue: