How to Monitor New File Creation in Folders with PowerShell

2 min read | Published On - January 15, 2025
Track new File creation with Lepide Auditor
x

New files should not be added to folders which contain sensitive data without the knowledge of system administrators and so to avoid this, it is essential to regularly monitor folder activity. One way to do this is to regularly run a straightforward PowerShell script to see all files which have been created or modified since you last ran the script.

The PowerShell script example below searches through a folder on a Windows share for new objects and outputs the results to your screen.

However, this process can be streamlined using the Lepide Data Security Platform. The Lepide Solution includes predefined reports which can easily generate a list of new files together with additional information such as who created the files. This is a more straightforward approach as it means you do not have to check and decipher the system event logs and along with the Lepide reports, you can create alerts to notify you every time a new file is created giving you immediate information on file creation activity.

In this article we will look at these two ways to monitor folders for new files. The first is the native method using PowerShell and the other is using the Lepide solution.

How to Use PowerShell to Check for New Files

Please follow below steps:

  • Open the PowerShell ISE
  • Run the following script, amending the path to the directory and the timeframe required:
    Get-ChildItem -Path \\pdc\Shared\Accounting\*.* -Filter * | ? {
    $_.LastWriteTime -gt (Get-Date).AddDays(-1)
    }
  • Review the results:
    File created output

How Lepide Helps

A more straightforward method which requires no knowledge of PowerShell scripting is to use the Lepide’s File Auditing software. The following is an example of the Files and Folders Created Report:
Lepide Auditor File Creation report

To run this report:

  • Select Lepide Auditor, Reports
  • From here, expand File Server
  • Select Files and Folders Created
  • Specify a time frame if required
  • Select Generate Report

The report is generated and can be filtered, sorted and exported to CSV and PDF formats.

See how Lepide File Auditing solution works
x
Learn More...

Track new File creation with Lepide Auditor

x
Learn More...