home *** CD-ROM | disk | FTP | other *** search
-
- // Count the total number of directories and files on the SYS: volume
-
- // Variables used:
- //
- // %0 : Directory we want to view
- // %1 : Total number of directories
- // %2 : Total number of files
- // %3 : Number of files in this directory
- // %4 : Current file
- // %9 : Original Working Directory
-
-
- // save the current working directory
-
- DEFINE %9 %CWD%
-
-
- // change to the directory we want to view
-
- CD SYS:\
-
-
- // define variable %0 as the root directory under SYS:\
-
- DEFINE %0 \
-
-
- // define variable %1 for use in counting directories
-
- DEFINE %1 0000
-
-
- // define variable %2 for use in counting files
- DEFINE %2 00000
-
-
- // display header
-
- ECHO Total Files Directory
- ECHO ------ ------ ------------------------
-
-
- // For directory counting, use a WHILE/LOOP which checks if %0 is defined
-
- WHILE "%0">""
-
-
- // Define variable %4 as the first matching entry in the file search
-
- DEFINE %4 %DIR_FILE_*.*%
-
-
- // Define variable %3 as the total number of files in directory
-
- DEFINE %3 0000
-
-
- // For file counting, use a WHILE/LOOP which checks if %3 is defined
-
- WHILE "%4">""
-
-
- // Increment %2 for each file found within any of the directories
-
- DEFINE %2 %2+=1
-
-
- // Increment %3 for each file found within this directory
-
- DEFINE %3 %3+=1
-
-
- // Define variable %4 as the next matching entry in the file search
-
- DEFINE %4 %DIR_FILE_%
-
-
- // LOOP back up to the WHILE check for the next matching file
-
- LOOP
-
-
- // display the directory information
-
- ECHO %2 %3 %CWD%
-
-
- // Define variable %0 as the next matching entry in the directory tree
- // If this is the first directory checked, we must provide a starting
- // point for the %DIR_TREE_% System Environment variable to work from
-
- IF %1==0000
- DEFINE %0 %DIR_TREE_SYS:\%
- ELSE
- DEFINE %0 %DIR_TREE_%
- ENDIF
-
-
- // Increment %1 for each directory checked as it traverses up/down the tree
-
- DEFINE %1 %1+=1
-
-
- // LOOP back up to the WHILE check for the next directory tree level
-
- LOOP
-
-
- ECHO.
-
- ECHO Volume SYS: contains %1 directories and %2 files...
-