List files in Creation Time order with Powershell

24 April,2013 by Jack Vamvas

Question: How do I list all files in a directory and order the files by Creation Time in ascending order, using Powershell?    

Answer:  Use  Powershell cmdlets – Get-ChildItem and Sort-Order to list the files in a directory .

If the item is a container, it gets the items inside the container, known as child items. Use the Recurse parameter to get items in all child containers.

The Sort-Object cmdlet sorts objects in ascending or descending order based on the values of properties of the object. In the example below, I’ve select a single property i.e CreationTime.  


#An example of listing items in a directory
 Get-ChildItem -path "C:\projects\testing\laboratory"

#An example of listing the items, filtering name and length and using sort-object
Get-ChildItem -path "C:\projects\testing\laboratory"| select name,lastwritetime,CreationTime | sort-object -property CreationTime


Read More 

SQL Database Size report using Powershell

SQL Server - Search and Delete files from a text based list with Powershell

SQL Server - Powershell Get-ChildItem with examples

Author: Jack Vamvas (


Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment on List files in Creation Time order with Powershell | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer