So I messed up. I was about the upload a file to my friends external hard drive when I saw a folder called "funny party images" - I opened it. And yeah - it wasn't party pictures! It was something than would embarrass my friend into eternity if he found out that I saw this.

So - How can I change the "last opened" metadata?

Thank you.


You need to use a script or program. The easiest way on Windows is with PowerShell. Try the following:

Open up PowerShell ISE from the start menu. The top half of the screen is a text editor, the bottom half is the PowerShell console (thats all you need to know).

Paste the below code into the top editor half of the screen.

$filename = "z:\funny party images\something-not-funny\badfile.jpg"

$newDate = Get-Date -Year 1999 -Month 12 -Day 31 -Hour 0 -Minute 0 -Second 0

if(Test-Path -Path $filename){

    $file = get-item -Path $filename

    Write-Host "$filename was last accessed $($file.LastAccessTime)"

    $file.LastAccessTime = $newDate

    Write-Host "$filename last accessed changed to $($file.LastAccessTime)"
    Write-Host "Cant find file"

Change line 1 to match your file.

Change line 3 to adjust the desired date.

Save the file in ISE

Press the green "Play" button. And look at the powershell console for the results.

If it works, you will see something like this:

PS C:\Users\YourName> C:\Users\YourName\Documents\ChangeLastAccessTime.ps1
z:\somefile.txt was last accessed 05/22/2020 19:00:58
z:\somefile.txt last accessed changed to 12/31/1999 00:00:00

If it just says Cant find file - check the path / folders / make sure you include the file extension (common ones are .jpg, or .avi). Update line 1. Save. Press the Play button again.


Using a third-party product is the best way.

For example : Attribute Changer.

Remember to do the folder and the files you looked at.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.