PC Review


Reply
Thread Tools Rate Thread

how to change the time stamp of a file ?

 
 
hon
Guest
Posts: n/a
 
      9th Sep 2004
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


 
Reply With Quote
 
 
 
 
Dean Wells [MVP]
Guest
Posts: n/a
 
      9th Sep 2004
hon wrote:
> 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


If the current date and time serves your purpose (or you're prepared to
change them temporarily to the desired date and time) you can use -

copy /b /y "your filename goes.here" +,,

To prevent the possibility of confusion, the command syntax reads -

copy<space><forward slash>b<forward
slash>y<space>"<filename>"<space><plus symbol> <comma><comma>

HTH

--
Dean Wells [MVP / Directory Services]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


 
Reply With Quote
 
Eric Langland
Guest
Posts: n/a
 
      10th Sep 2004
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" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> 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

 
Reply With Quote
 
hon
Guest
Posts: n/a
 
      10th Sep 2004
thx for This-line-intentionally-left-blank , Dean Wells [MVP] , Eric
Langland
, actually I use sftp to get a lot of log files from others servers , but
the time is not really i want (the time i copied ) , i want the files's
attribute is the past timestamps (the date time it created) .

thx


"hon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
hon
Guest
Posts: n/a
 
      10th Sep 2004
what type of utility ?
is it a app or bat file ?
it looks very good

thx ,

"Eric Langland" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message

news:<(E-Mail Removed)>...
> > 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



 
Reply With Quote
 
Eric Langland
Guest
Posts: n/a
 
      10th Sep 2004
I am having some trouble understanding your question. If I have it right,
1. You have some log files from other servers.
2. The log files now have timestamps according to the time you copied them.
3. You want to change the timestamp for each log to the time when it was
created.

Can you tell us how we can find out when the log was created? I could imagine
at least two possibilities:
1. Look at the file's creation timestamp.
2. Look at the data inside the file.



hon wrote:

> thx for This-line-intentionally-left-blank , Dean Wells [MVP] , Eric
> Langland
> , actually I use sftp to get a lot of log files from others servers , but
> the time is not really i want (the time i copied ) , i want the files's
> attribute is the past timestamps (the date time it created) .
>
> thx
>
> "hon" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >
> >


 
Reply With Quote
 
Eric Langland
Guest
Posts: n/a
 
      10th Sep 2004
My DTstamp.exe and Steve P. Miller's Touch.exe are both console applications.

hon wrote:

> what type of utility ?
> is it a app or bat file ?
> it looks very good
>
> thx ,
>
> "Eric Langland" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message

> news:<(E-Mail Removed)>...
> > > 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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I change the email time stamp to match my computer time? DonnaP Microsoft Outlook Discussion 1 30th Jan 2009 10:16 PM
time stamp a cell that doesn,t change when time stamping another =?Utf-8?B?UkM=?= Microsoft Excel Programming 5 13th Oct 2005 02:52 AM
Looking for freeware to change date / time stamp on file. whayface Freeware 13 30th Jan 2004 09:50 AM
Looking for freeware to change date / time stamp on file. whayface Freeware 2 29th Jan 2004 06:00 PM
Time Stamp of a Save As file Doesn't Change from Original froschatten Microsoft Excel Misc 1 14th Jan 2004 01:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:10 AM.