Very often System administrator has to work with file and folder operations to get file creation date timestamp, filename to extract all information in CSV based on filter criteria.
I love working with PowerShell scripts as tasks easily get done in no time. Using PowerShell to get file creation date format, the filename can be easily retrieved.
To get file creation date in PowerShell, use the PowerShell Get-ChildItem cmdlet. Get-ChildItem is used to gets items or child items in one or more specified locations.

In this article, I will explain about get file creation date, get files created today using PowerShell.
PowerShell Get File Creation TimeStamp
To get file date timestamp in PowerShell, use Get-ChildItem cmdlet. Run below command
Get-ChildItem -Path D:\PowerShell\ActiveDirectoryGroupList.csv | select Name,CreationTime
In the above PowerShell script, Get-ChildItem get file object using specified location -Path and pass the output to the second command.
Second command select file Name
and file CreationTime
properties and print it on PowerShell console as below
Name CreationTime
---- ------------
ActiveDirectoryGroupList.csv 04-10-2020 14:40:07
Cool Tip: How to use Get-Date to get current date time in PowerShell!
PowerShell Get Files Created Today
To get files created today using PowerShell, use the Get-ChildItem cmdlet to get files and compare file creation date with today date. Run below command
Get-ChildItem -File | Where-Object {$_.CreationTime -gt (Get-Date).Date}
In the above PowerShell script to get files created today, the first command gets file object in the current directory and passes the output to the second command.
The second command compares file CreationTime greater than today’s date (Get-Date) and get files created today and prints output on the console.
Directory: D:\PowerShell
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 24-07-2021 20:40 46 GetFileProperties-Assignment.txt
PowerShell – Get all Files with Creation Date
To get all files with creation date-time in PowerShell in descending order as per creation date timestamp, use the below command
Get-ChildItem -File | select Name,CreationTime | sort CreationTime -descending
In the above PowerShell command, the first command get file objects in current directory and pass output to the second command.
The second command selects file name and file creation time and passes the output to the third command.
Third command sort file objects descending by their creation time to get the latest file created on top of the list and print list of files on console as below
Name CreationTime
---- ------------
GetFileProperties-Assignment.txt 24-07-2021 20:39:42
print-spooler-service.ps1 03-07-2021 17:01:55
comppingstatus.csv 24-10-2020 20:03:35
complist.txt 24-10-2020 19:15:39
vscode-docker-master.zip 06-10-2020 18:08:39
ActiveDirectoryGroupList.csv 04-10-2020 14:40:07
Employee.xlsx 04-10-2020 12:24:42
PowerShell Get File Creation Date by extension
To find files creation date by file extension, use PowerShell Get-ChildItem cmdlet to get file object and apply extension filter to select file only.
Get-ChildItem -File -Recurse| Where {$_.Extension -eq ".txt"} | select Name,CreationTime
In the above PowerShell Get-ChildItem command, the first command gets file objects recursively through folders and subfolders and passes the output to the second command.
Second command search for file extension equal to .txt and gets only *.txt file objects and pass output to the third command.
The third command selects file name and file creation date time and prints it on the console.
Cool Tip: How to find large size files in PowerShell!
Get Files Count Created Today
To get files count created today, run below PowerShell command
(Get-ChildItem -File | Where-Object {$_.CreationTime -gt (Get-Date).Date} | Measure-Object).Count
In the above PowerShell script, the Get-ChildItem cmdlet gets file object and passes it to the second command.
The second command compares file creation date time with today’s date and returns file objects to the third command.
Third command Measure-Object
performs the calculation over file objects and gets file count created today.
Cool Tip: How to delete file if exists in PowerShell!
Conclusion
I hope the above article guides you to effectively use the PowerShell Get-ChildItem cmdlet to get file creation date or find files created today.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.