Open In App

Count-files module in Python

Last Updated : 31 Jul, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

Count-files module is a command-line utility written in Python to get count and information of files with extensions. Its functionality to check files and extensions in any route provided can also be used to check files without or irrespective of extensions.

Installation

This module does not come built-in with Python. To install this type the below command in the terminal.

pip install count-files

Parameter Descriptions

count-files [-h] [-v] [-st] [-a] [-nr] [-c] [-nf] [-hc] [-t EXTENSION] [-alpha] [-fe FILE_EXTENSION] [-p] [-ps PREVIEW_SIZE] [-fs] [path] 

ArgDescription
-hPrint all the help and exit.
-vShow version number and exit.
-stList of supported file types for preview.
-aAlso, show hidden files.
-nrDon't recurse for subdirectories.
-cTreat all files case-sensitively.
-nfTurns off the program's operating indicator
-hcStart interactive help on the topic.
-t EXTENSION Gets a total number of files in the directory.
-alphaSorts the result table alphabetically.
-fe FILE_EXTENSION Search files of a particular extension.
-pAlso, display a preview of the text. Only available on text message.
-fsShow sizes of each file found 
-ps PREVIEW_SIZE Entering the size of preview required.
pathEnter the path to check files in.

Example 1: Print count and files of the current directory

Example 2: Getting a count of all files irrespective of extension, including hidden files ( Using ..), Getting total of non-specified extensions ( Using .) 


Next Article
Article Tags :
Practice Tags :

Similar Reads