Re: how to change the time stamp of a file ?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Eric Langland (elangland_at_earthlink.net)
Date: 09/10/04


Date: 9 Sep 2004 22:46:02 -0700

The easiest way to change the creation/modification timestamps would
be to use a utility. I've written one that will do what you ask, and
I would be happy to share it with you. Here's a sample script using
my DTstamp utility:

@echo off
:: etouch.bat by Eric Langland
:: Change a file's timestamp to the current date and time

IF "%1"=="" ECHO Usage: etouch filespec & GOTO:EOF
:: Get the date
FOR /F "tokens=2" %%A IN ('ECHO %DATE%') DO SET MyDate=%%A
:: Get the time
FOR /F "tokens=1 delims=." %%A IN ('ECHO %TIME%') DO SET MyTime=%%A
ECHO Current date/time is %MyDate% %MyTime%
ECHO/
:: Change the timestamp
ECHO Updating the timestamp on %~1 ...
C:\utils\dtstamp "%~1" -w -d %MyDate% -t %MyTime%

...and here's the syntax for DTstamp.exe:
C:\Scratch\Test Stamp Files>c:\utils\dtstamp /?

DTstamp version 1.1 by Eric Langland, 2003
Lists or changes date and time stamps on files.

Usage: DTstamp [drive:][path]filename -C -W -A -D date -T time -ISO
-FAT

  -C List or change Creation date and/or time.
  -W (default) List or change last Write date and/or time.
  -A List or change last Access date and/or time.
  -D date Change the date.
  -T time Change the time.
  -ISO List dates in ISO format (YYYY-MM-DD).
  -FAT Attempt to list/change creation time or last access
time on
               non-NTFS drives, even if not supported by the file
system.

Notes:
The filename is the only mandatory parameter. Wildcards ? and * are
accepted.
UNC network paths like \\server\share\subdirectory are accepted.

The -C, -W and -A parameters may be used in any combination. If -C,
-W and -A
are not specified, then -W is assumed.

Dates and times can be entered in a wide range of formats.
Omit both date and time to list the current date/time stamps.

My utility is not available for download because I don't have a
server, but I could email it to you if you like. Others have written
similar utilities. You might try Steve P. Miller's touch.exe, which
has more features than my utility. Steve's download page is
http://stevemiller.net/apps/ and touch.exe is part of his Win32
Console ToolBox.

Hope that helps,
Eric

"hon" <athatisme@hotmail.com> wrote in message news:<O3s59RnlEHA.1672@TK2MSFTNGP14.phx.gbl>...
> hi all,
>
> I would like to change a file's (such as text file) timestamp(the date and
> time created or modified ) by script , how can i do that ?
>
> thanks a lot



Relevant Pages

  • Re: Lets talk about graphs
    ... The large data set is here ... Joanna Joanna 2005-04-09 13:00 ... by adding a test on combining lists. ...
    (comp.lang.awk)
  • Re: Timestamp monitoring
    ... check the timestamp of the last file and do something is one file has ... Remove the word "echo" in Line 3 to activate the batch file. ... how to compare 2 lists ...
    (microsoft.public.windows.file_system)
  • Re: Timestamp monitoring
    ... check the timestamp of the last file and do something is one file has ... how to compare 2 lists ... would vbs be more elegant, listing the dir in an array, check the ...
    (microsoft.public.windows.file_system)
  • Re: Elevation profile from gps data
    ... a timestamp with a previus time. ... stamps on the track points in the .gpx file. ... You can see that in g7towin, or a text editor of the .gpx file. ... "I'm a great believer in luck, and I find the harder I work, the more I have of it." ...
    (sci.geo.satellite-nav)
  • Re: Elevation profile from gps data
    ... a timestamp with a previus time. ... I make a simple algorithm to detect them, but I think it isn't very ... stamps on the track points in the .gpx file. ... You can see that in g7towin, or a text editor of the .gpx file. ...
    (sci.geo.satellite-nav)