Change a file's modified date in PowerShell
Timestamps are writable properties — set LastWriteTime or CreationTime on (Get-Item file) directly.
01Command
$ (Get-Item 'C:\Photos\IMG_0001.jpg').LastWriteTime = '2026-03-15 14:30:00'02What it does
Because FileSystemInfo exposes settable DateTime properties, no special cmdlet is needed — assignment is the whole trick. It works through pipelines too: Get-ChildItem *.log | ForEach-Object { $_.LastWriteTime = Get-Date } refreshes many files at once. Note this changes filesystem metadata only; EXIF dates inside photos are separate data.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Get-Item | Microsoft LearnEvidence: SS64 shows assigning .LastWriteTime / .CreationTime on (Get-Item file) and a SetFileTime pattern for bulk timestamp changes.
- FileSystemInfo.LastWriteTime Property | Microsoft LearnEvidence: Microsoft documents that FileSystemInfo.LastWriteTime is get/set and accepts a DateTime, allowing timestamp modification.
Last verified: 2026-09-17 · Category: Files & Folders
06Related solutions
Diagnose NTFS file system errors and bad sectors on any volume — including the system drive while Windows is running — before committing to a repair.
Robocopy is Windows' built-in robust file copier: use /MIR to keep a destination folder as an exact one-way mirror of a source, resumable and restartable.
Search inside text files and logs with regex, returning file, line number and match.