Home ยป How to Get Folder Creation Date in PowerShell

How to Get Folder Creation Date in PowerShell

To get the folder creation date in PowerShell, you can use the Get-Item cmdlet to retrieve folder information and then access the CreationTime property.

The following methods show how to use it with syntax.

Method 1: Get the folder creation date using Get-Item cmdlet

# Specify the path to the folder
$folderPath = "C:\temp\log\syslog\"

# Get the creation date of a folder

(Get-Item -Path $folderPath).CreationTime

This example returns the creation date of a folder in PowerShell.

Method 2: Get the folder creation date using Get-ChildItem cmdlet

# Specify the path to the folder
$folderPath = "C:\temp\log\"

# Get the creation date of a folder

(Get-ChildItem -Path $folderPath).CreationTime

This example outputs the folder creation date time to the console.

The following examples show how to use these methods.

Get the Folder Creation Date Using Get-Item Cmdlet in PowerShell

To get the folder creation date in PowerShell, you can use the Get-Item cmdlet to retrieve the folder information and then access the Creationtime property to get the creation date of a folder.

# Specify the path to the folder
$folderPath = "C:\temp\log\syslog\"

# Get the creation date of a folder

(Get-Item -Path $folderPath).CreationTime

Output:

PowerShell get creation date of a folder using get-item
PowerShell get creation date of a folder using get-item

The output shows the creation date of a folder.

Get the Folder Creation Date Using Get-ChildItem in PowerShell

Another way to get the folder creation date is by using the Get-ChildItem cmdlet that retrieves the folder information and then accesses the Creationtime property.

# Specify the path to the folder
$folderPath = "C:\temp\log\"

# Get the creation date of a folder

(Get-ChildItem -Path $folderPath).CreationTime

Output:

PowerShell get creation date of a folder using get-childitem
PowerShell get folder creation date using get-childitem

The output shows the creation date of a folder specified by the $folderPath variable.

Conclusion

I hope the above article on getting the folder creation date in PowerShell is helpful to you.

You can find more topics about Active Directory tools and PowerShell basics on the ActiveDirectoryTools home page.