Here is one way, there are probably more elegant ways out there: opendir DIR,"/home/path/to/dir"; @list = readdir DIR; foreach $file (@list) { unlink $file if $file =~ m/\.bak$/; } closedir DIR;
-----Original Message----- From: Sara [mailto:[EMAIL PROTECTED] Sent: October 29, 2003 15:45 To: beginners-cgi Cc: [EMAIL PROTECTED] Subject: unlink help. unlink <*.bak>; how I am supposed to specify directory above? for example I have to apply above unlink command to delete all backup files in the Specified directory. $dir = /home/path/to/dir is it right? unlink <$dir/*.bak>; ?? Any ideas? Thanks, Sara.