|
#!/usr/bin/perl
package main;
&xJCDRead("E:\\",0);
sub xJCDRead {
my ($xpath,$xtab) = @_;
my $i;
my $j;
$xtab ++;
my $tmpfile = "jcdread.tmp";
system("dir \"$xpath\" > $tmpfile\n");
open(xIN,"$tmpfile");
my @xlist=<xIN>;
close(xIN);
system("del $tmpfile");
for($i=5;$i<=$#xlist-2;$i++) {
($xdate,$xtime,$xsize,$xname,$xnames) = &xJDIRline($xlist[$i]);
if($xsize eq "<DIR>") {
if($xname eq "\." || $xname eq "\.\.") {}
else {
for($j=0;$j<$xtab;$j++) { print " ";}
print "$xtab:$xnames $xdate $xtime <DIR> $xpath$xname\n";
&xJCDRead("$xpath$xname\\",$xtab);
}
}
else {
for($j=0;$j<$xtab;$j++) { print " ";}
print "$xtab:$xnames $xdate $xtime $xsize $xname\n";
}
}
}
sub xJDIRline {
my ($xline)=@_;
$xline =~ s/\n//g;
my @xlist = split('',$xline);
my $xnames = join('',@xlist[0..7]);
$xnames =~ s/\s//g;
my $xext = join('',@xlist[9..11]);
$xext =~ s/\s//g;
if($xext) { $xnames = "$xnames\.$xext";}
my $xsize = join('',@xlist[15..25]);
$xsize =~ s/\s//g;
my $xdate = join('',@xlist[28..35]);
my $xtime = join('',@xlist[38..42]);
$xtime =~ s/\s//g;
my $xname = join('',@xlist[44..$#xlist]);
($xdate,$xtime,$xsize,$xname,$xnames);
}
|
|