why not use foreach() glob() and unlink() instead so it's all done in perl?
foreach $file (glob("e:/dir/*.ldb")){ next if $file =~ /exception pattern here/; unlink($file) or die "Cannot unlink $file: $!\n"; } > -----Original Message----- > From: Ned Cunningham [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 09, 2002 9:35 AM > To: '[EMAIL PROTECTED]' > Subject: Regex exception > > > HI all. > > A simple question. > > I need to use a system command to delete all files in a > directory except > one. > > Foobar.ldb > Barfoo.ldb > Raboof.ldb > Keep.ldb > > I want to delete all except the keep.ldb and there could be > various other > files. > > I am trying to use this command > > Any help??? > > System("erase /f e:\\dir\\*.ldb"); > > Or > (`erase /f "e:\\dir\\*.ldb"`) > > How do I substitute for the * > > $file =~ (/keep/I); ???? > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > ---------------------------------------------------------------------------- -------------------- The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]