SDIR(1) SDIR(1) NAME sdirstat - scan the directory hierarchy and print statistics. SYNOPSIS sdirstat [OPTIONS]... DESCRIPTION The command sdirstat scans directories starting from the current directory, and passing through all directory tree originated from the current directory (visiting all its subdirectories and for each of them visiting its subdirectories etc.), prints the subdirectory and possibly the file names and possibly (if requested) accumulates and prints at the end various statistics. One special and very useful possibility is to print all file names (cumulatively from all directo- ries) in chronological order (see -T option). Options of sdirstat are one-character words started from "-". As usu- ally for programs like "ls" or "tar", many options can be combined in one word. Some options of sdirstat are similar and have same meaning as that of "sister" program sdir. Some options of sdirstat are not valid for sdir and vice versa. Due to limited number of characters all "new" options of sdirstat are assigned to be marked by upper-case characters. GENERIC OPTIONS -v Versouse, report scanned directory names and something else. -w No warnings and auxiliary information, which can interfere if this program is run from scripts. -h Prints help and quit. -c Prints copyright and quit. -l Follows symbolic links. Otherwise does not follow them. But even if the option -l is supplied and the program follows links, it will not enter the directories second time if it already once entered them (which allows to avoid infinite loops in the case of backward references). -f Prints directory names with full path. Otherwise full path is printed only if it differs from the current directory from which the program was started. This is possible if the option -l is supplied and if the directories contain links to outside of the tree. -m Prints file names seen in each directory. -M Prints file names seen in each directory followed by statisti- cal numbers: file size and, if ordered, number of lines, number of non-empty lines, and number of non-comment lines. -a Prints statistics at the end: the number of visited directories and levels (that is the deepest level found in this tree), the number of files and their total size. See the "sister" program sdirstat(1) and apply it for more detailed statistics. -A Prints detailed statistics at the end - the same as for previ- ous option plus table of file name extensions versus their num- ber and size. If A is rised, a is also comsidered rised in the program. So -aA or -Aa or -a -A or -A -a are all the same as -A. -E Together with table supposed for -A option prints table of file names and their characteristics identified as belonging to this file name extension. -T Prints the whole file names time-ordered plus all the statis- tics for each file. LINES-OF-CODE -RELATED OPTIONS The following set of options can be used for estimation of the numbers of "Lines Of Code" (LOC) and related values for large source code depositories and take into account how some people are used to save backup copies and what are today the most popular syntax of comments in programming languages. The options allow one to estimate both everything as well as to try to gently skip backup copies, empty lines and comments as far as it is possible in a flexible and generic way. This results in a set of numbers from which you are expected to choose the relevant ones. -S Add numbers with no repetitions of file names at computing statistics." It leads to appearance in results lines marked by "-same nam" which means "minus files with the same names": all files except those which have the same file name (being located in different directories) and have older dates of modification. This rule is NOT applied to subdirectory names: files located in subdirectiries with the same names can pass this test. -U Add numbers with no repetitions for upgraded names at computing statistics. It leads to appearance in results lines marked by "-num vers" which means "minus files numerical versions of the same files"; all files except those which have the file name different only by a number before .extension from the file located in the same directory. For example, "name.ext" and "name1.ext". Only the file without number ("name.ext" in this example) is then accounted. The same rule IS applied to subdi- rectory names as well: if a subdirectory is a numerically labelled version of another subdirectory, the both being located in the same directory, the numerically labelled one it is not taken into account. -L If statistics is ordered, print not only size, but the number of lines and the number of non-emtpy lines as well. Corre- spondingly two additional numbers (columns) will be added in output. The program recognizes not only ordinary \n-style new- line mark, but also Windows \r\n-marks. Invoking this option makes the program READ all files, which makes it work much slower. But sometimes knowing the numbers of lines is just nec- essary! Obviously, the number of lines have sense only for text files but the program produces this for all files which it meets. User is expected to ignore these numbers for the files which he believes are binary. -C Adds additional number (column) which gives the number of lines without those which are empty and without those which are com- pletely filled by blanks or by C++ comments. The program recorgizes //... and /*...*/ comments. The program does not do consistent cpp-like preprocessing, so it is not excluded that in some exotic cases its measurements can be wrong. For exam- ple, the program does not include files (according to include directives), which could be nonsense if the user just wants to count the number of lines in a given file. So potentially there is a subtle chance of some miscalculation, but in most of the cases, taking into account how people usually write programs, it is expected to give correct or nearly-correct num- bers of lines of C++-code. -d Prints some statistics for each directory - the number of file names, the number of files and their total size. VERSION This description is valid for version 2.3 issued 09.02.2008. AUTHOR Igor B. Smirnov REPORTING BUGS ibsmirnov@mail.ru COPYRIGHT Copyright (c) 2007, I. B. Smirnov This program can be used, copied, modified, and distributed according to the terms of GNU General Public License version 3 published by the Free Software Foundation 29 June 2007, and provided that the above copyright notice, this permission notice, and notices about any modi- fications of the original text appear in all copies and in supporting documentation. The program is provided "as is" without express or implied warranty. SEE ALSO Documentation on ls(3), du(3), locate(3), sdir(1). SDIR(1)