How to know total number of files in a directory in windows 10 / 11

There might be a situation where we would need the count of files/folders within a given folder. This kind of data is especially required for automation purposes or to maintain the statistics. Whatever be the reason, counting the files manually will be time-consuming if there are a lot of files in the folder. Windows has various options available to help its users with the count.  In this article let’s discuss the various ways to get the total number of files in a folder and the total number of the specific file type in a folder.

Method 1: From Properties

Step 1: Right-Click on the Folder and choose Properties

 

 

Properties

 

 

Step 2: In the Properties window, under the General tab, Contains section has the count of items( files and folders) within that folder.

 

 



Contains Section

 

 

Solution 2: From Command Prompt

Open Run Window (Windows+r) and type cmd and press Enter.

 

 

Cmd

 

 

In the Command Prompt window, navigate to the location of the folder using chdir command as follows:

chdir <location to the file>

 

For Example, to navigate to the Test folder that is on the desktop, we give its complete path as follows :

chdir C:\Users\User1\Desktop\Test

 

Case 1: Count the Total Number of files

Now, that the directory is changed to the required folder. we say,

dir

 

At the bottom, we can see the count of files. Refer to the below image.

 

 

Command Prompt

 

 

Case 2: Count Specific File Extensions

In order to find the count of the specific file type in a folder, we give the command,

dir *.<filetype>

 

For Example, if we want to find the total number of Pdf files in the Test folder we say,

dir *.pdf

 

Refer to the snapshot below

 

Specific File Type Command Prompt

 

Solution 3: From Power Shell

Open Run Window (Windows+r) and type powershell and press Enter.

 

 

Powershell

 

 

Case 1: Count the Total Number of files

In the powershell window,  type the following command

Write-Host (<Full-Path to the file> | measure).Count

 

For example, if we want to cunt the file within the folder test that is located in the Desktop folder , we have to specify the following ,

Write-Host (C:\Users\User1\Desktop\Test | measure).Count

 

Refer to the snapshot below for more details.

 

Powershell Count Command

 

 

Case 2: Count Specific File Extensions

In order to find the count of the specific file type in a folder, we give the command,

Write-Host (<Full-Path to the file> *.pdf | measure).Count

 

For Example, if we want to find the total number of Pdf files in the Test folder we say,

Write-Host (C:\Users\User1\Desktop\Test *.pdf | measure).Count

 

Refer to the snapshot below

 

 

Specific File Type Powershell

 

Solution 4:  From Explorer

Hold Windows+r keys at the same time to open Run Window ad type explorer and hit Enter

 

 

Explorer

 

Alternatively, you can double-click on the File Explorer icon in the taskbar to open the explorer window.

You could also do it by holding Windows+ e keys together.

Locate the folder from which the total number of files should be counted.

Method 1: From the Bottom Left Corner

Case 1: Count the Total Number of files

Go to the folder, In the bottom left corner, you can see the total number of items in that folder.

 

 

Bottom Left Corner

 

 

Case 2: Count Specific File Extensions

In the search tab, at the top-right corner of the window, type the *.<file-extension> and hit enter

For example, if u want to count the total number of pdf files in the folder, in the search tab, say, *.pdf, and hit Enter.

In the bottom right corner, you can see the count. Refer to the below snapshot.



 

 

Specific File Type

 

 

Method 2: Using View Tab Settings

Case 1: Count the Total Number of files

From the folder Menu,

  1. From View tab.
  2. Select the Detail pane 
  3.  On the right-hand side, the Details pane appears with the total number of items(files/ folders) within that folder.

Alternatively, click anywhere on the screen (except on any items or menu options) and press Ctrl+ Alt +P to open the details pane.

 

 

View Details Tab

 

 

Case 2: Count Specific File Extensions

In the search tab, at the top-right corner of the window, type the *.<file-extension> and hit enter

For example, if u want to count the total number of pdf files in the folder, in the search tab, say, *.pdf, and hit Enter.



Now, follow instructions under Case 1 and enable the Details pane, you can see the count in the Details pane.

 

 

Specific File Type 2

 

That’s All. Thank you for Reading. Hope this has been informative. Please comment and let us know the solution you liked the most.