source: trunk/essentials/dev-lang/perl/NetWare/t/NWModify.pl

Last change on this file was 3181, checked in by bird, 19 years ago

perl 5.8.8

File size: 2.8 KB
Line 
1
2
3print "\nModifying the '.t' files...\n\n";
4
5use File::Basename;
6use File::Copy;
7
8## Change the below line to the folder you want to process
9$DirName = "/perl/scripts/t";
10
11$FilesTotal = 0;
12$FilesRead = 0;
13$FilesModified = 0;
14
15opendir(DIR, $DirName);
16@Dirs = readdir(DIR);
17
18foreach $DirItem(@Dirs)
19{
20 $DirItem = $DirName."/".$DirItem;
21 push @DirNames, $DirItem; # All items under $DirName folder is copied into an array.
22}
23
24foreach $FileName(@DirNames)
25{
26 if(-d $FileName)
27 { # If an item is a folder, then open it further.
28
29 opendir(SUBDIR, $FileName);
30 @SubDirs = readdir(SUBDIR);
31 close(SUBDIR);
32
33 foreach $SubFileName(@SubDirs)
34 {
35 if(-f $SubFileName)
36 {
37 &Process_File($SubFileName); # If file, process it.
38 }
39 else
40 {
41 $SubFileName = $FileName."/".$SubFileName;
42 push @DirNames, $SubFileName; # If sub-folder, push it into the array.
43 }
44 }
45 }
46 else
47 {
48 if(-f $FileName)
49 {
50 &Process_File($FileName); # If file, process it.
51 }
52 }
53}
54
55close(DIR);
56
57print "\n\n\nTotal number of files present = $FilesTotal\n";