Home > Archive > PERL Beginners > September 2007 > Invalid top directory at d:\perl\lib\file\find.pm line 562
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Invalid top directory at d:\perl\lib\file\find.pm line 562
|
|
| Perler 2007-09-27, 7:59 am |
| 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 $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::DriveInfo::DriveType($drive
s[$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 :)
| |
| usenet@DavidFilmer.com 2007-09-27, 7:59 am |
| On Sep 27, 1:29 am, ninad...@gmail.com (Perler) wrote:
> [a multipost]
Please don't multipost.
--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)
|
|
|
|
|