How to count files in a directory w/PERL
|
02-12-2019, 10:25 PM
Post: #1
|
|||
|
|||
How to count files in a directory w/PERL
To find the total number of files (and subdirectories) in any directory, just include this snippet in any cgi file in that directory.
$dirt = './'; @files = <$dirt/*>; $count = $#files + 1; $#files is the count of the last file. Since operating systems count from zero the last file number requires a plus 1 to achieve the actual total. Here is a simple page to demonstrate: http://jawjahboy.com/scripts/perl/filecount.cgi Here is code that creates the page: http://jawjahboy.com/scripts/perl/filecount.txt Here is a very involved application using this snippet to show the count of my smiley and avatar images: http://jawjahboy.com/Graphics/smileys-av...age-count/ |
|||
02-13-2019, 09:34 PM
Post: #2
|
|||
|
|||
RE: How to count files in a directory w/PERL
Well, that's interesting......thanks...
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)