One of the most useful tools of Windows operating systems is PowerShell which is slowly becoming the ideal solution for the entire console work theme thanks to its various cmdlets that help us optimize many tasks in the system..
One of these tasks, which few we knew, is to change the date of creation of a file or folder and this is useful in administration, audit or similar tasks, event management, etc.
Today we will see how to perform this process in a practical way with Windows PowerShell..
To keep up, remember to subscribe to our YouTube channel! SUBSCRIBE
1. Change file creation date within a Windows 10 folder with PowerShell
The first option we will see is to change the creation date of all files within the selected folder.
Step 1
We have the following files:
Step 2
As we can see, they have a creation date on January 30, 2018. If you do not see the creation date, we go to the “View / Add columns†menu and there select “Creation Dateâ€:
Step 3
To change the date of all files, we will execute the following in PowerShell:
Get-ChildItem D: \ Tests \ TechnoWikis | % {$ _. CreationTime = '12 / 12/2017 10:00 '}
Step 4
With this script we will define the path where the files to be edited are located and with the “CreationTime†variable we set the month, day and year to be assigned. We will run this in PowerShell as administrators:
Step 5
We refresh the destination folder and we can see that the date has been edited:
2. Change concrete file creation date in Windows 10 with PowerShell
Step 1
The next alternative we have is to edit the creation date of a particular file using PowerShell, in this example we will edit the file called TechnoWikis to the desired date and for this we execute the following:
Get-ChildItem D: \ Tests \ TechnoWikis \ TechnoWikis.txt | % {$ _. CreationTime = '01 / 01/2018 10:30:40 '}
Step 2
In this case we have defined that this particular file has the creation date on January 1, 2018 at 10:30 am:
Step 3
We can see the change in the selected file:
2. Change concrete folder creation date in Windows 10 with PowerShell
Step 1
Finally, if we want to change the creation date of the folder that contains the files we will execute the following, first we validate the creation date of the folder:
Step 2
Now we execute the following:
Get-Item D: \ Tests \ TechnoWikis | % {$ _. CreationTime = '10 / 01/2018 09:00:00 '}
Step 3
We will see the respective change:
We see how simple it is to perform this task in Windows PowerShell.