Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

Overwriting existing file never change creation time in NTFS

Overwriting existing file like 1..10 > file.txt, 1..10 | Out-File file.txt, or 1..10 | Set-Content file.txt, never changes creation time in NTFS.

You have to delete the file explicitly like rm file.txt; 1..10 > file.txt, or change creationTime explicitly like Set-ItemProperty .\file.txt -name CreationTime -Value (Get-Date).