V
VbScripter
I swear I am not a newbie
I am trying to write something simple that needs to test and then
recurse into subdirs.
I have tried 10 differet ways, and all I can get is . and .. in any
given directory.
This needs to work on RH8.0 and or HP-UX 11.11
#!/usr/bin/perl
# looks through dirs
print "Please enter in a dir name ";
$dir=<>;
chomp($dir);
opendir(DIR,$dir) or die "$dir does not exist or I can't open
it\n\n";
@files= readdir(DIR);
closedir(DIR);
for $file(@files){
chomp($file);
my $ftype="";
($device,$inode,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
$blksize,$blocks) = stat($file);
$ftype = ($mode & 0170000)>>12;
# if($ftype!=8){
print "$file = $ftype and mode = $mode\n";
# }
}
I of cours tried if ( -d $dir ) but it only returns . and ..
Please help..
Thanks in advance
I am trying to write something simple that needs to test and then
recurse into subdirs.
I have tried 10 differet ways, and all I can get is . and .. in any
given directory.
This needs to work on RH8.0 and or HP-UX 11.11
#!/usr/bin/perl
# looks through dirs
print "Please enter in a dir name ";
$dir=<>;
chomp($dir);
opendir(DIR,$dir) or die "$dir does not exist or I can't open
it\n\n";
@files= readdir(DIR);
closedir(DIR);
for $file(@files){
chomp($file);
my $ftype="";
($device,$inode,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
$blksize,$blocks) = stat($file);
$ftype = ($mode & 0170000)>>12;
# if($ftype!=8){
print "$file = $ftype and mode = $mode\n";
# }
}
I of cours tried if ( -d $dir ) but it only returns . and ..
Please help..
Thanks in advance