Miscellaneous

This is my getDirectory Subroutine

[cc lang="perl"]

sub getDirectory {

# —————————-
# Sub getDirectory
# —————————-

chdir();
chdir($openPath);
$pathFound=eval(opendir(DIR, $openPath));
foreach (sort readdir(DIR)) {
next unless (-d $_);
next if (m!^\.\.?$!);
next if ($_ eq $skip_folder_1 or
$_ eq $skip_folder_2 or
$_ eq $skip_folder_3 or
$_ eq $skip_folder_4);
push(@folderSize, -s $_);
push(@folderName, $_);
}
rewinddir(DIR);
foreach (sort readdir(DIR)) {
next unless (-f $_);
next if (m!^\.\.?$!);
next if ($_ eq $skip_file_1 or
$_ eq $skip_file_2 or
$_ eq $skip_file_3 or
$_ eq $skip_file_4);
push(@fileSize, -s $_);
push(@fileName, $_);
}
closedir(DIR);

if (!$pathFound){$pathError = 1;}

}

[/cc]

[ccb lang="perl" theme="coryinline"]
sub getDirectory {

# —————————-
# Sub getDirectory
# —————————-

chdir();
chdir($openPath);
$pathFound=eval(opendir(DIR, $openPath));
foreach (sort readdir(DIR)) {
next unless (-d $_);
next if (m!^\.\.?$!);
next if ($_ eq $skip_folder_1 or
$_ eq $skip_folder_2 or
$_ eq $skip_folder_3 or
$_ eq $skip_folder_4);
push(@folderSize, -s $_);
push(@folderName, $_);
}
rewinddir(DIR);
foreach (sort readdir(DIR)) {
next unless (-f $_);
next if (m!^\.\.?$!);
next if ($_ eq $skip_file_1 or
$_ eq $skip_file_2 or
$_ eq $skip_file_3 or
$_ eq $skip_file_4);
push(@fileSize, -s $_);
push(@fileName, $_);
}
closedir(DIR);

if (!$pathFound){$pathError = 1;}

}

[/ccb]

About the Author

Programmer