How to Count Number of Files or Subfolders Inside a Folder

Even though I have moved my data to Google Drive, I still have a lot of data on my hard drive. Checking for subdirectories and files that exist inside the main directory is tedious. I’m sure we’ve all been in this situation at some point.

Count the number of files or subfolders

That can cause trouble, mainly if there are many subfolders inside subfolders with files stored inside them. You cannot count them manually. Too cumbersome, and boring! To solve this problem, I will share with you several methods to find not only the total number of subfolders located in a directory, but also the total number of files within them.

Let’s get started.

1. View properties

This is probably one of the simplest methods of knowing what’s in that directory. You won’t need any additional software for it. Simply locate the folder or subfolder where you need to count the subfolders or files, right click on it, then click Properties from the context menu. You can also press ALT+Enter to open the Properties of a folder or subfolder.

Count the number of files or subdirectories 1

Depending on the make and model of your computer and the size of the folder, Windows may take some time to calculate. When it’s ready, you can see the total size of the main folder, the subfolders within it, and the number of files inside those folders and subfolders.

Count the number of files or subdirectories 2Note:

2. Using File Explorer

File Explorer allows you to browse through all the files and folders inside your hard drive. You can directly launch it by pressing the keyboard shortcut Windows Key + E or go to My Computer and select the correct partition. File Explorer can also be used to quickly find the number of subfolders or files inside a particular folder.

See more:  How to Force Restart Roblox on Mobile or PC

Open the folder and select all subfolders or files manually or by pressing the keyboard shortcut CTRL+A. If you choose manually, you can select and skip specific files.

Count the number of files or subdirectories 3

You can now see the total near the bottom left of the window. Repeat the same for files inside a folder and subfolders. It is useful when you need to know the total number in a particular directory.

3. Command Prompt

Quite a few Windows users prefer to use the command prompt. It can be a powerful tool if you know how to use and remember the commands correctly. This one is for people using command prompt. Press the Windows key and type RUN to open the Run dialog box. Type cmd and press enter to launch the command prompt.

Count the number of files or subdirectories 4

You will see a new window with a black background and white text. Now you have to enter the path containing the folder. First, I will use the CD command to change the drive from C to H because the command prompt opens to point to the C drive by default. I type CD/ to go back to the root of Drive C and type the drive letter with a colon (H:) to change the drive. Then enter the directory path before the CD command to open the desired directory.

Count the number of files or subdirectories 5

Just like the CD command is used to change directories, the DIR command is used to work with directories. To count all files and subdirectories inside a parent directory or directory, enter the following command.

dir *.* /w /sCount the number of files or subdirectories 6

Don’t worry if you see the text auto-scroll. Finally, you can see the total number of files and folders (subfolders) inside the main folder. That includes all files and directories when the command is recursive.

See more:  All Pokemon GO Amazon Prime Gaming rewards & how to redeem (October 2023)

Count the number of files or subdirectories 7

4. PowerShell

Feeling a little eccentric? For advanced users, having PowerShell is one step higher than what we’ve seen with the command prompt when the difficulty level is reached. Use the Windows search feature to find Windows PowerShell and click on it.

Count the number of files or subdirectories 8

This time, you will see a new window pop up with a blue background. Navigating to your desired folder is easier in PowerShell. Just type cd followed by your directory structure.

cd h:\databaseCount the number of files or subdirectories 9

To count all files or subdirectories inside the parent directory, copy and paste the following command.

Get-ChildItem | Measure-Object | %{$_.Count}

You will notice that the results I got above are different. This is because the instruction is not recursive, meaning it won’t go one level deeper. So there are 5 subfolders.

Count the number of files or subdirectories 10

To recursively count all files and directories:

Get-ChildItem -Recurse | Measure-Object | %{$_.Count}

To recursively count only directories:

Get-ChildItem -Recurse -Directory | Measure-Object | %{$_.Count}

To recursively count only files:

Get-ChildItem -Recurse -File | Measure-Object | %{$_.Count}Count the number of files or subdirectories 11

5. Witch Tree

Finally, let’s take a look at a piece of software that not only makes life simpler, but also helps to better understand what kind of files you have in a folder. WizTree is a hard drive analysis tool that collects a variety of data metrics such as file extensions and their respective numbers, space occupied by each format as well as by individual files and folders.

Count the number of files or subdirectories 12

If you click on the little ‘+’ icon next to a folder, it will show you a tree structure with their individual details. So you can easily drill down into the hierarchy of folders and subfolders without having to switch back and forth between them.

See more:  How to Unlock SP-X 80 in Modern Warfare 2

Know how to count

As discussed above, there are quite a few ways to count the number of files and folders or subdirectories inside the main directory. Depending on your needs, you can choose the built-in Windows Explorer or the more powerful WizTree software which will also share other details in a tree-like structure.

Next up: Do you use Skype on Windows 10? Learn how you can record Skype calls for important meetings or conversations.

Categories: How to
Source: thpttranhungdao.edu.vn/en/

Rate this post

Leave a Comment