top of page
To list files, use the ls operator. If no arguments are included, you will get the files in your current directory. Otherwise, you will get files in the names directories. You can use "glob" patterns, as in Linux.
The ls operator produces a stream of File objects. These can be piped to other commands for further processing. For example, this command lists files (-f) recursively (-r), maps each File to a tuple containing the File's extension (e.g. '.py') and the number 1, and then groups by extension and sums up the 1s, to obtain the number of files of each extension. The results are sorted by extension.
bottom of page