codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  having problem in reading directory  sanjaysingh79 at 07:13 on Tuesday, November 07, 2006
 

I m reading all files and directory in a given directory using the below code but when I m trying to test wethere $file ( in below code ) is a file or dir it is not happening. Can u please tell me the error.

opendir DIR, 'C:/Perl/eg/test/test' || die "could not open the current directory: $!" ;

while (my $file = readdir(DIR) ) {

if ($file eq "." or $file eq ".." or $file eq "/forum/readdir.html" ) {

print "oops not a log file\n";

}

else {


if (-d $file) { print "dir\n";

}

if (-f $file) { print "file\n";
}

print "$file\n";


}

}
closedir(DIR);


In the ab



  Re: having problem in reading directory  lekku at 00:51 on Tuesday, January 30, 2007
 

$dir = "d:/mp3"; Directory do u want

#use Cwd; If you want go to local file folder
#$dir = cwd;
chdir $dir;

opendir(DIR, $dir) or die "can't opendir $dirname1: $!";
while (defined($file5 = readdir(DIR))) {
print $file5 . "\n";
};
closedir(DIR);


  Re: having problem in reading directory  mimir at 12:32 on Monday, February 26, 2007
 

10.5?
http://www.hermanningjaldsson.com/1/pdg/pdg.html









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Date script issues
•  perl script help needed
•  onChange issue
•  perl remote execution
•  Chat application
•  How to send multiple perameters in SOAP request.
•  Java code for Insert picture on the table in spreadsheet
•  Re: Problem with concatenation
•  how to genrates the crystal report by sending a id at runtime


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007