Advertisement
zaxecivobuny

some guy's powershell to update file modified information

Feb 7th, 2021
749
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # https://www.tenforums.com/general-support/69943-date-last-modified-year-field-set-year-2036-some-files.html
  2. $path="D:\Whatever Directory"
  3. $today = (Get-Date)
  4. $future = (Get-Date 2036-01-01)
  5.  
  6.  
  7. Get-ChildItem $path -r |
  8. ForEach-Object {
  9.     if ((Get-Date $_.LastWriteTime) -ge $future) {
  10.          $_.CreationTime = $today
  11.          $_.LastAccessTime = $today
  12.          $_.LastWriteTime = $today
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement