P
Perler
Hi, i am using the following script to find a file entered by a user.
use Win32:riveInfo;
use File::Find;
my @drives = Win32:riveInfo:rivesInUse(); #Get the drives on a
Machine
my $cnt=@drives; #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:riveInfo:riveType($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 $cnt=@t;
$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
$cnt=@p;
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
use Win32:riveInfo;
use File::Find;
my @drives = Win32:riveInfo:rivesInUse(); #Get the drives on a
Machine
my $cnt=@drives; #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:riveInfo:riveType($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 $cnt=@t;
$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
$cnt=@p;
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