Open In App

Count-files module in Python

Last Updated : 31 Jul, 2021
Improve
Improve
Like Article
Like
Save
Share
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] 

Arg Description
-h Print all the help and exit.
-v Show version number and exit.
-st List of supported file types for preview.
-a Also, show hidden files.
-nr Don’t recurse for subdirectories.
-c Treat all files case-sensitively.
-nf Turns off the program’s operating indicator
-hc Start interactive help on the topic.
-t EXTENSION  Gets a total number of files in the directory.
-alpha Sorts the result table alphabetically.
-fe FILE_EXTENSION  Search files of a particular extension.
-p Also, display a preview of the text. Only available on text message.
-fs Show sizes of each file found 
-ps PREVIEW_SIZE  Entering the size of preview required.
path Enter 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 .) 


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads