- Joined
- Nov 11, 2010
I noticed recently that someone loaded some pictures onto our shared drive from a digital camera that had the incorrect date set, so the pictures had created/modified dates of January 16, 2020.
Since my shared drive scans record the UNC pathname to each file I exported those records to a text file and threw together a script that changes their created/modified dates.
Since my shared drive scans record the UNC pathname to each file I exported those records to a text file and threw together a script that changes their created/modified dates.
Code:
$now=Get-Date -format "dd-MMM-yyyy HH:mm"
$files=(get-content C:\test\input1.txt)
foreach($file in $files) {
$d=(get-item $file)
If ($d.LastWriteTime -lt $now) {
write-host $file "* ok *"
}
else
{
write-host "FIXING Last Write Time for ",$file
$d.LastWriteTime = $now
write-host "Fixed!"
}
}