When you save a script as a droplet or runtime, dragged files are stuffed into @ARGV with full path info. Simply iterate over @ARGV. But remember, since they will be absolute paths, you need to consider the path info or you may get errors: (.*:)(.*)\s(\d+) for example where $1 is the path, $2 the file "root", and $3 the numeric extension after whitespace. -K "To argue with a man who has renounced his reason is like giving medicine to the dead." - Thomas Paine > From: John McDermon <john@mcdfamily.com> > Date: Thu, 30 Mar 2000 15:57:45 -0700 > To: macperl@macperl.org > Subject: [MacPerl] MacPerl batch file renaming? > > Hi All, > I like your book, but I'm sortof new to Perl and certainly new to > Perl on a Mac. I have what I think should be a relatively simple task > that I hope MacPerl will be able to handle. I have literally hundreds > of files with goofed up names that I would like to rename. The > actions fall into several broad categories. So I'll describe each by > and example. > > 1) filename 1 --> filename1 > 2) filename 1 --> filename_1 > 3) filename.ext --> filename > 4) filename --> filename.ext > > I think I could handle the first one by passing each filename to a > regular expression searching for the first blank something like "(*) > ([1-9]+)" and then doing a rename to $1$2. > > The second example is very simple (I think) > s/\s/_/; > > The third would be > "(*).*" renaming to $1 > > The fourth would be > "(*)" renaming to $1.ext > > I see in the book the reserved work "rename(OLDNAME,NEWNAME) which > looks like it'll do the trick something like this for the first > example: > > $currentname = "(*) ([1-9]+)"; > $newname = $1$2; > rename($currentname,$newname); > > The thing I don't know how to do is pass a list of filenames to the > script either by dragging and dropping a folder of bunch of files and > then how to process the list. > > I'm sure I can't be the first person to ask this type of question so > rather than write the script for me, do you know where I might be > able to get an example that would point me in the right direction? > > TIA, > --John > > +-----------------------------------+ > | John McDermon | > | john@mcdfamily.com | > | http://www.mcdfamily.com | > +-----------------------------------+ > > # ===== Want to unsubscribe from this list? > # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org > # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org