Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

September 13, 2004 12:00 AM

JSI Tip 8460. How can I modify a files timestamp?

Windows IT Pro
InstantDoc ID #81784
Rating: (0)


If you wish to set a files 'date modified' timestamp to the current date and time, you can use native commands. To modify the 'date modified' timestamp of H:\Folder\FileName.ext:

pushd H:\Folder
copy /b /y "FileName.ext" +,,
popd

NOTE: The archive bit is NOT set.

If you wish more control, use Touch.exe:

===============================================================================

Description: Touch displays or sets the created, access, and modified times of one or more files.

-------------------------------------------------------------------------------

Touch for Win32, Version 1.0
Freeware by Steve P. Miller (stevemil@pobox.com).  Copyright 1997.
Visit http://pobox.com/~stevemil for the latest version and other utilities.

Usage: touch [/s] [/h] [/p] [/q] [/v] [/c] [/m] [/a] [/r file]
             [/d mm-dd\[-[cc]yy]] [/t hh\[:mm\[:ss\[.ms]]]] filespec ...

  /s Process subdirectories.
  /h Process hidden/system files/directories.
  /p Prompt for each file (Yes/No/All/Quit). Ignored in view mode.
  /q Quiet mode; Only display errors; Ignored in view mode.
  /v View mode; Display times rather than set times.
  /c View/set created time.
  /m View/set modified time; Default if /a and /c are not specified.
  /a View/set accessed time.
  /r Reference file; Use this file's date and time to set other files.
  /d Date: month, day, century, year.
  /t Time: hour (0-24), minutes, seconds, milliseconds.

In view mode (/v), the /p, /q, /r, /d, and /t options are ignored.
In set mode, the default is to use the current date and time.
Use the /r, /d, and/or /t options to override the default set time.
The century (cc) is assumed to be 19 for years 69-99, and 20 for years 00-68.



Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.