How to Change a File/Folder Date Timestamp Using Command Line and Other Tools

In Windows 10 and 11, every file and folder contains certain attributes that help define their properties. In this post, we will discuss the following attributes: Date ModifiedDate Created and Date Accessed. If you need to modify these attributes, there are a few methods you can use, including the command-line approach and some third-party tools.  

This information can be found in each and every file or folder, regardless of the type of file, which means that each document, photo, video, zipped file, and folder carries this information with them wherever they are transferred. Those who are interested in knowing this information about a particular item only need to examine its properties or metadata.  

The date modified, the date created, and date accessed are referred to as timestamps. There is a record of the last time the respective changes were made. In addition, these are used by the system to save previous versions of a file/folder by reading, if it is designed to archive or save its last version.

Date Modified, Date Created, and Date Accessed

As in the example below, the 3 attributes can be seen in Windows Explorer. You may notice how each category displays both the date as well as the time of the event for each item.

Attributes displayed in File Explorer

Date Modified depicts the event when the last changes were made to the item. In the case of a text document, anything added or removed from it will automatically update the Date Modified timestamp to the current time. In the case of a folder, any changes made to the contents within the folder, such as new items added or removed, will change the Date Modified timestamp. However, if you were to modify a file within a folder, the Date Modified timestamp of the parent folder will not change.

Some may think that the Date Modified attribute is dependant upon the hard drive it is saved on, and not the metadata of the item. However, this theory is not true. You can verify this by creating a test document in one place, and then moving it to another storage device at another time. You will notice that the new copy of the item still retains its old Date Modified timestamp.

Similarly, Date Created is the date and time when an item was first created. This does not change when you make changes to an item, nor does copying it to another storage device. However, if you make a new copy of an existing file or a folder, the Date Created is automatically updated for the new copy to the current time.

Lastly, as the name suggests, Date Accessed tells us of the last time an item was accessed. It does not necessarily have to be modified Read-only privileges will also change this timestamp to the current time.

How to Modify file and folder timestamps

Now that you understand what each timestamp indicates and how they are modified, let us move on to manually change them in case you ever need to.

All 3 timestamps can be changed to your requirements manually. To do so, there are tools present on the internet, and it can also be done through your Windows command-line. Remember that modifications need to be a time of the past, and not of the future. Setting the timestamps to a future time will make the information disappear from the Explorer.

Change Date Modified, Date Created, and Date Accessed using Windows PowerShell

Windows PowerShell is a command-line tool that comes preinstalled in Windows 10 and 11. It is super-handy for superusers as it allows you not only to control your Operating System but also lets you automate tasks. Similarly, you can use the commands given below to modify the 3 timestamps to your preferences.

Change Date Modified

Launch Windows PowerShell with administrative privileges and then use the following command to change the Date Modified in the file/folder:

(Get-Item "PathToItem").LastWriteTime=("14 August 2016 13:14:00")

Remember to replace PathToItem in the command above with the complete path to the file/folder that you wish to change the attribute of (including the file type). Also, change the date and time to your preference. Here is an example:

(Get-Item "D:\TestDocument.txt").LastWriteTime=("14 August 2016 13:14:00")
date modified ps
PowerShell: Command to Manipulate Date Modified Attributes

Run the command above and make changes to the text file in the D drive named “TestDocument.txt.” This was then verified through File Explorer. Here are the results:

date modified ps results
Date Modified timestamp for TestDocument has been changed

Change Date Created

Likewise, you can also manipulate the Date Created attribute of a file/folder using the command below:

(Get-Item "PathToItem").CreationTime=("13 August 2015 13:18:00")

As in the last example, change the PathToItem as well as the date and time of your preference in the command above. Here is an example of us changing the Date Created attribute of a folder named “Newfolder” in the D drive:

date created ps
PowerShell: Command to manipulate Date Created attribute

As expected, the Date Created attribute has been changed.

date created ps results
Date Created timestamp for Newfolder has been changed

Change Date Accessed

To manipulate the Date Accessed attribute using PowerShell, use the command below:

(Get-Item "PathToItem").LastAccessTime=("3 August 2019 17:10:00")

Always change the PathToItem as well as the date and time according to your preferences.

We shall not dwell on an example and its results, as you have already seen in the manipulation of the Date Modified and Date Created timestamps.

However, in case you notice that the Date Accessed is not changing on your system, it is very likely that the feature has been turned off. You can easily activate it by launching Command Prompt with administrative privileges, and then pasting the command given below:

fsutil behavior set disablelastaccess 0
Activate Date Accessed attribute

You should now be able to see an updated Date Accessed timestamp each time you open a file or a folder.

Change all 3 attributes of all items within a folder

You can also change all 3 timestamps of all the items within a folder. To do so, simply use the commands shown below, adjust them to your requirements, and voila! You are done changing the timestamps in a jiffy.

Get-ChildItem -force PathToItem * | ForEach-Object{$_.CreationTime = ("14 August 2016 13:14:00")}
Get-ChildItem -force PathToItem * | ForEach-Object{$_.LastWriteTime = ("14 August 2016 13:18:00")}
Get-ChildItem -force PathToItem * | ForEach-Object{$_.LastAccessTime = ("14 August 2016 13:22:00")}

Remember to replace PathToItem with the complete path of the folder as well as the date and time that you wish to configure.

ps all in one
PowerShell: Command to change all 3 attributes within a folder

As you can see in the image below, all contents within the folder named “Newfolder” have updated their attributes as commanded through PowerShell.

ps all in one results
All 3 attributes changed within a folder

There are other similar commands you can use in Windows PowerShell to change the attributes of any file or folder. Nonetheless, all have a similar effect to that which we have discussed in this post.

Change Date Modified, Date Created, and Date Accessed using Attribute Changer

Attribute Changer is a small GUI-based utility that you can install on your system to manipulate the attributes of any file or folder using the context menu. Follow the steps below to install the tool and then learn how to use it in a few easy steps.

Open the Attribute Changer page and then click on Get Attribute Changer. The setup will then start to download. Once completed, click on it to begin the installation. The installation wizard will then open. Agree to the terms and conditions and follow through with the wizard in a few quick steps. The installation part only takes a few minutes.

Once installed, the app will not open by itself, since it is programmed to be launched through the context menu when you right-click a file or a folder.

context menu
Attribute Changer in the context menu

To change a file or folder’s Date Modified, Date Created or Date Accessed, simply right-click on it and then click Change Attributes on the context menu.

Note: You may need to click Show more options in the context menu if you are using Windows 11.

Clicking Change Attributes will open the Attribute Changer in a new window showing the details of the item that you have selected. In the File Properties tab, check the box next to “Modify date and time stamps.” The greyed-out portion below will now be active and can be modified. You can now adjust the Date Modified, Date Created and Date Accessed according to your own preferences using these options.

attribute changer
Attribute Changer

Once the required changes are made, click on Apply and then Ok. You will now notice that the changes have been updated in File Explorer.

AC results
Changes made through Attribute Changer

We would like to point out that changing the timestamps of an entire folder will not affect its contents. Therefore, you will be required to change them for each item individually.

Closing words

Timestamps provide insight into the digital content they are associated with. Documents and folders contain these digital time signatures embedded in their metadata. Using the guide provided in this post, these can be modified for any given reason in a few minutes.

Additionally, there are other tools available online for manipulating these stamps. However, Attribute Changer has proven to be the most convenient to use.

Also see:

Leave a Reply

You have to agree to the comment policy.