renee has asked for the wisdom of the Perl Monks concerning the following question:

how to write a perl script to search for a file using File:Find b4 delete it from the server?

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Answer: how to search for a file
by Corion (Patriarch) on Mar 16, 2001 at 13:22 UTC

    File::Find is very easy to use, if your program runs on the machine that has mounted the filesystem the file is on. File::Find does not search web servers or ftp servers for files.

    Now for some simple example code, more code can be found by using Super Search and searching for "file find" :

    use strict; use File::Find; my $startDir = "c:/"; find( sub { # We only want files ending in ".mp3" if ($File::Find::name =~ /\.mp3$/) { print "Found " . $File::Find::name . "\n"; } }, $startDir );