How to Count Files in a Folder or a Directory

{{ firstError }}
We care about security of your data. Privacy Policy
Native Auditing Netwrix Auditor for Windows File Servers
Native Auditing
Netwrix Auditor for Windows File Servers
  1. Open the PowerShell ISE → Run the following script, adjusting the directory path:

Get-ChildItem \\pdc\Shared\Accounting -Recurse -File | Measure-Object | %{$_.Count}

  1. Review the results:
PowerShell count files in a folder report
  1. Run Netwrix Auditor → Navigate to "Reports" → Choose "File Servers" → Click "File Servers - State-in-Time" → Select "Folder Summary Report" → Click "View".
  2. Add the appropriate path to the "Object UNC Path" filter.
  3. Click "View Report".

To save the report, click the "Export" button → Select a format, such as PDF → Click "Save as" → Choose a location to save it.

Netwrix Auditor Folder Summary Report: Shows the total number of files and folders, the file owners, and the total file size.

Learn a Quick and Easy Way to Count Files in a Folder with PowerShell or Netwrix Auditor

During your day-to-day tasks, you may need to count the files in a folder on a Windows server or provide full statistics on how many files a folder or contains. This information helps you get better insight into your file structure and facilitates other file management tasks. Instead of checking the number of files and directories manually, you can simply run the PowerShell command provided above and then search through the results to find the particular data you need.

Alternatively, you may want to use Netwrix Auditor for Windows File Servers. It not only lists the number of files in a directory or multiple directories, but also provides extended details such as the total file size and the file and folder owners. As a result, you can satisfy report requests faster and manage users’ data more efficiently.

Related How-tos