Hi, i am using the following script to find a file entered by a user.

 use Win32::DriveInfo;
 use File::Find;

 my @drives = Win32::DriveInfo::DrivesInUse(); #Get the drives on a
Machine

 my [EMAIL PROTECTED];  #Number of Drives

 my $i=$cnt; #Counter assignment

 #The following loop appends "/" to the drive letter
 #if the drive is a fixed drive.

 for($i;$i>0;$i--)
 {
    $type=Win32::DriveInfo::DriveType($drives[$i-1]);
    if($type==3)#fixed drives
    {
                $d[$i-1]=$drives[$i-1].":"."\\","\\";
        }
 }

 $temp=$ARGV[0]; #store filename to be found

 my @t=split(/\./,$temp); #Split the filename to get the extension

 my [EMAIL PROTECTED];

 $f=".".$t[$cnt-1]; #Append "." and extension

 find(\&cleanup,@d);  #standard file find function

 sub cleanup {

        if ((/$f/))#$f= appneding "." and file extension for eg:
$f=.pl,$f=.txt
   {
                $path=$File::Find::name;   #$path will contain the complete
path of a file

            @p=split(/\//,$path); #just get the file name

            [EMAIL PROTECTED];
            if($p[$cnt-1] eq $temp)
                {
                        print "\n File Found",$path;
                }



   }

 }


If i run this script i am getting the error as  "Invalid top directory
at d:\perl\lib\file\find.pm line 562, <DATA> line164"

Pls help me.


Thanks in advances :)


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to