Hi everyone,
I have been given this code to modify. Basically I'm the only person who has any clue of perl but I don't know that much really. Would somebody be able to fill into the code below that is required to display the owner of the file. As it is the code works on NT and I have never written anything for NT. The code searches through directories and checks their details, I don't evn know if it is possible to get the owner of the file. I have never seen some of the stuff below and I don't even know why the 6th line would even compile.
Any help would be greatly appreciated.
Thanks for your time,
Marcus
#!/user/bin/perl
$time = 182;
$return = "c:\\Hlr\\hlrinfo.txt";
$path = "h:\\";
$c = 0;
dir[$c] = $path;
$c++;
open(OUT,">$return"
|| die "cannot open";
format OUT_TOP=
ALL FILES THAT HAVE NOT BEEN MODIFIED IN THE LAST 6
MONTHS:
==========================================================================================
Path | FileName
|Days since
|
|last Mofified
.
format OUT =
==========================================================================================
$path1
$name
$age2
.
format OUT1 =
$name
$age2
.
$old = select(OUT);
$= = 400000;
select($old);
for($b = 0;$b<$c;$b++){
$path1 = 0;
$path1 = dir[$b];
opendir(IN,"$path1"
|| die "cannot open";
$f = 0;
while($name = readdir(IN)){
$path2 = "$path1\\$name";
if($name eq "\."
{
next;}
if($name eq "\.."
{
next;}
if(-f $path2){
$age = (-M $path2);
$age1 = index($age,"."
;
$age2 = substr($age,0,$age1);
if($age > $time){
if($f == 0){
$oldHandle = select(OUT);
$~ = "OUT";
select($oldHandle);
write OUT;
$f = 1;
}
elsif($f == 1){
$oldHandle = select(OUT);
$~ = "OUT1";
select($oldHandle);
write OUT;
}
}
}
elsif(-d $path2){
dir[$c] = "$path1\\$name";
$c++;
}
}
closedir(IN);
}
I have been given this code to modify. Basically I'm the only person who has any clue of perl but I don't know that much really. Would somebody be able to fill into the code below that is required to display the owner of the file. As it is the code works on NT and I have never written anything for NT. The code searches through directories and checks their details, I don't evn know if it is possible to get the owner of the file. I have never seen some of the stuff below and I don't even know why the 6th line would even compile.
Any help would be greatly appreciated.
Thanks for your time,
Marcus
#!/user/bin/perl
$time = 182;
$return = "c:\\Hlr\\hlrinfo.txt";
$path = "h:\\";
$c = 0;
dir[$c] = $path;
$c++;
open(OUT,">$return"
format OUT_TOP=
ALL FILES THAT HAVE NOT BEEN MODIFIED IN THE LAST 6
MONTHS:
==========================================================================================
Path | FileName
|Days since
|
|last Mofified
.
format OUT =
==========================================================================================
$path1
$name
$age2
.
format OUT1 =
$name
$age2
.
$old = select(OUT);
$= = 400000;
select($old);
for($b = 0;$b<$c;$b++){
$path1 = 0;
$path1 = dir[$b];
opendir(IN,"$path1"
$f = 0;
while($name = readdir(IN)){
$path2 = "$path1\\$name";
if($name eq "\."
next;}
if($name eq "\.."
next;}
if(-f $path2){
$age = (-M $path2);
$age1 = index($age,"."
$age2 = substr($age,0,$age1);
if($age > $time){
if($f == 0){
$oldHandle = select(OUT);
$~ = "OUT";
select($oldHandle);
write OUT;
$f = 1;
}
elsif($f == 1){
$oldHandle = select(OUT);
$~ = "OUT1";
select($oldHandle);
write OUT;
}
}
}
elsif(-d $path2){
dir[$c] = "$path1\\$name";
$c++;
}
}
closedir(IN);
}