A PowerShell script that edits the:
of a file or a folder.
The following commands should be run with powershell.exe.
Syntax:
& ([scriptblock]::Create((iwr https://raw.githubusercontent.com/taljacob2/edit-date-of-file/master/edit-date-of-file.ps1 -useb))) -Path <String> [-NewDate (<DateTime>)] [-Recursive | -Rec | -R]
Examples:
Edit a file with a specific date.
& ([scriptblock]::Create((iwr https://raw.githubusercontent.com/taljacob2/edit-date-of-file/master/edit-date-of-file.ps1 -useb))) -Path demo.txt -NewDate (Get-Date('2020-12-31T23:54:43'))
Edit a folder with the current date.
& ([scriptblock]::Create((iwr https://raw.githubusercontent.com/taljacob2/edit-date-of-file/master/edit-date-of-file.ps1 -useb))) -Path C:\Users\demo
Edit a folder and all of its content, with a specific date.
& ([scriptblock]::Create((iwr https://raw.githubusercontent.com/taljacob2/edit-date-of-file/master/edit-date-of-file.ps1 -useb))) -Path C:\Users\demo -NewDate (Get-Date('2020-12-31T23:54:43')) -R
git clone https://github.com/taljacob2/edit-date-of-file
.\edit-date-of-file.ps1 -Path <String> [-NewDate (<DateTime>)] [-Recursive | -Rec | -R]
In case you encouter an error, try running with:
powershell.exe -NoLogo -ExecutionPolicy Bypass -Command ".\edit-date-of-file.ps1 -Path <String> [-NewDate (<DateTime>)] [-Recursive | -Rec | -R]"
To view the full documentation of the script, run:
Get-Help .\edit-date-of-file.ps1 -Full