Touched By PowerShell

Today I was asked how to “touch” all files in a folder in Windows to set the Modified timestamp to now. If I was asked about the Created timestamp I would have suggested to copy the files to a new folder and use the copies which will have a new Created timestamp. Unfortunately Windows doesn’t seem to have an easy way to edit the Modified timestamp.

Thankfully, everyone who has Windows also has PowerShell, or should have, or should upgrade their OS. With PowerShell, touching files is easy:

Get-ChildItem * | % { $_.LastWriteTime = [DateTime]::Now }