Sometimes you get the oddest requests if you have a website feedbackform.
Here's one I received earlier.
> Hi! Just found your page through Google. I have a project that needs to be
> completed tomorrow. It involves creating 120 text files containing the
> names of 120 image files. I am of course desperately searching for an
> AppleScript that can do the job for me. Do you know where I could find
> one? To be more exact, what it needs to do is read the names of files in a
> given folder and for each one create a text file containing the name of
> the original file, and then save each file in the same folder. The files
> could have the same names as the originals but with a .txt suffix.
> Would greatly appreciate any help you could offer!
Now I have no idea why anyone would want to do something like this but the problem intrigued me so I wrote a small Perlscript that does what the guy wanted. I did the script in Perl as Applescript isn't really my forte and Perl is about ten times as fast (at least). That also gave me the benefit of reusing some old code. Code Reuse is Good™
I decided to put the textfiles in a new folder on the Desktop rather than in the imagedirectory itself, but that can easily be changed.
Another bonus of using Perl is of course that the script should run on just about any *NIX system out there with only minor modification. (It should even work on Windows systems running CygWin, though I haven't tested that yet and probably never will as my iBook has arrived, giving me the benefit of a completely portable OS X system even when at work.)
Anyway, the script (which is well-commented) is here if you want it: download the tar-gzipped script