Blue Flower

How To Change The Date And Time Of Folders (Directories) And Files

This article goes over how to change the date and time of folders and files on a Linux, Windows, and MAC operating systems. 

I am not paid to to write these articles.  The content of this article is my opinion, and not meant to be legal advice, and presented in a best effort, and reader is responsible for usage of any methods or instructions within this article.  Creation of this article took 4 hours or more.

On Linux

Requirements

  1. You will need terminal command level access, or use terminal emulator.
  2. You will need to be root or at least the user that owns the folder or file you want to change the time stamp on.
  3. You will need to indicate both the new date and time during the change.

Example

Lets say you cut and pasted a folder named Myfolder and it's contents from a networked Windows system, such as via Samba, onto a Linux server or shared station.   You discover that the files retained their time stamps, but the folder date and time got changed to when you did the paste, and the original date and time of the folder was January 8, 2012 at 1:23 PM your time zone. 

Change date and time of folder, named Myfolder, to be 1/8/2012 1:23 PM by entering and executing this at command line:

touch -t 201201081323 Myfolder

The format of the timestamp is YYYYMMDDHHmm.ssYYYY = 4 digit number that represents the Year of the date.  MM = 2 digit number that represents the Month of the date.  DD = 2 digit number that represents the Day of the date.  HH = 2 digit number that represents the Hour of the time.  mm = 2 digit number that represents the Minute of the time.  Finally, the optional, .ss = a period first and then the 2 digit number that represents the Seconds of the time.

If the above gives you an error, then possibly a different format is required by your version of touch program.   You can enter the command of man touch to see what the manual for the program touch shows as the needed format.

 

On Windows

Requirements

  1. You will need to be logged in as Administrator (logged in as owner).

No Easy Way, But Ways

It seems on a Windows systems in general and on XP, there really is no easy way of doing this.  Listed here will be a Trick Method and 3rd Party Software Usage Method.

Trick Method

You can use the trick of changing your your computer's date and time and then copying the folder or file which will get the new date and approximate time.  Once you got a folder or file with the timestamp wanted, then immediately change the computer clock back to todays date.  I have not tested this to see if it creates an confusion in the computer when doing this, but I have changed Windows dates many times in the past, and for the most part I do not recall any issues pretty much most of the time.  However, if I recall correctly, over time, depending how long you leave it changed and how many other things you do, an accumulated effect can cause unwanted computer behavior.

3rd Party Software Usage Method

I've located some softwares that change timestamp of files and folders.  They are listed here with some summary comments.

  1. BulkFileChanger: works on Windows 2000 to Windows 8 at the very least.  Both 32-bit and 64-bit systems. No installation needed, and just runs when you open it.  Provides ability to change many file and folders at once.  Can change date, time and other attributes.

  2. Attribute Changer: works on Windows XP, Vista, 7 and 8 at the very least.   Both 32-bit and 64-bit systems.  Once installed, you can right mouse click on a folder or file to change the date and/or time, and can do other changes too.  Provides the ability to change lots of folders and files at once.

  3. SetFileDate 2.0: A nice easy small free program with a nice interface. I don't know what versions of Windows are supported by this software, but works on Windows XP.  Can "alter the time and date of one or more selected files or folders".

  4. SKTimeStamp: Allows you to change the Created, Last Modified, and Last Accessed timestamps for any file in a Windows computer. There seems to be both 32 and 64 bit versions supported on their site.  It adds a TimeStamps tab Properties window when you right mouse click on a file or folder. Images can bee seen here.

 

On Apple Mac OS X and probably other Mac OSs

Similar to the Linux description above, the Mac also makes use the touch program via terminal software. 

Requirements

  1. You will need terminal command level access, thus usage of a terminal emulator.
  2. You will need to indicate both the new date and time during the change.

Example

Lets say you want to make the directory Myfolder have the date and time of January 8, 2012 at 1:23 PM your time zone. 

  1. Start the Terminal software (located at /Applications/Utilities/Terminal.app). Also iTerm terminal emulation software is available.

  2. Change date and time of folder, named Myfolder, to be 1/8/2012 1:23 PM by entering and executing this at command line:
      touch -t 201201081323 Myfolder

    1. You can drag and drop a folder or file into the Apple terminal window, and the path will be added to the end of the line.  So, you could just type touch -t 201201081323 and then drag and drop Myfolder and get something like touch -t 201201081323  /Volumes/Mac\ HD/Test/MyFolder.

The format of the timestamp is YYYYMMDDHHmm.ssYYYY = 4 digit number that represents the Year of the date.  MM = 2 digit number that represents the Month of the date.  DD = 2 digit number that represents the Day of the date.  HH = 2 digit number that represents the Hour of the time.  mm = 2 digit number that represents the Minute of the time.  Finally, the optional, .ss = a period first and then the 2 digit number that represents the Seconds of the time.

If the above gives you an error, then possibly a different format is required by your version of touch program.   You can enter the command of man touch to see what the manual for the program touch shows as the needed format.

 

Consider Contributing

Some of those softwares may take contributions.  If you found one useful, then consider making a contribution to the developer as a simple thanks.  Often the suggested contribution is $5, but any amount can typically be given above or below; even just one dollar ($1).  If a Paypal contribution button is used, then it is as safe as the contribution button on my site, above (left side), for contributions to Tech Notes.

 

Feel Free To Leave A Good Comment. :)

Look around, and you may find other useful articles. Add this site to your Bookmarks/Favorites for easy return for new articles. Consider submitting technical articles for publication, including your embedded links. I will even create a new category if needed.

Comment (0) Hits: 3152