How to change file creation or modified date

Using PowerShell, you can change the creation date of a file using the following command:

parameter is: public static void SetCreationTime (string path, DateTime creationTime);

[System.IO.File]::SetCreationTime(“C:\AFolder\Afile.pdf”, (Get-Date “19/12/2020 10:25:25”)

Using PowerShell, you can also change the last-modified date of a file:

[System.IO.File]::SetLastWriteTime(“C:\AFolder\Afile.pdf”, (Get-Date “19/12/2020”))

How to change date of a folder?

(Get-Item  "C:\AFolder").LastWriteTime = '01/01/2021 13:00:24' 

Related articles:

Source file names are larger than supported file system

References:

File.GetCreationTime Method

Windows
Total 0 Votes
0

Tell us how can we improve this post?

+ = Verify Human or Spambot ?