get-childitem sort-object : how to sort by CreationDate

You can use the command below to get the files sorted by date:

gci | sort creationtime

This works for me:

gci . | ? { $_.PSIsContainer } | sort CreationTime | select name,creationtime

Your output show LastWriteTime and not CreationTime.

And 'CreationDate' not exists as property for a file/Directory object.


dir /od sorts by modification time. If you want to do the same thing in powershell, you need to sort by the last write time, and not by creation time.

So that would be :

gci | sort lastwritetime