Click to See Complete Forum and Search --> : Simple script to find files with certain names


melsalhy
05-24-2003, 03:38 PM
Hello all,
Is there a simple perl script to search a certain directory (folder) on the server and look for and list files whose names contain a certain string that the user chooses?

There used to be a script out there called "Site File Finder" but it is no longer available. Any help would be greatly appreciated.

Thanks and regards. :)

jeffmott
05-24-2003, 06:48 PM
$a_certain_string = 'foo';
chdir '/a_certain_directory' or die $!;
@names_that_match = grep { /$a_certain_string/ } glob '*';

melsalhy
05-24-2003, 08:12 PM
Thank you for your reply post but as a newbie, I am merely at the cut-n-paste stage so far! Would it be too much to ask you to kindly provide the actual (and complete) script in its entirety i.e. starting at the !#usr/bin/perl and all the way?

Thanks and best regards.