Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Command-line TOUCH utility?

    I'm trying to find a command-line TOUCH utility to change the "Modified Date./Time" of a file, one which is not thrown by the change from Standard time (in my case, GMT) to Daylight Saving Time (in my case, British Summer Time, BST).

    I've been using the Microsoft NT 4 Resource Kit utility TOUCH (from July 1996!)
    syntax: TOUCH /T yyyy mm dd hh mn ss filename.ext
    but now find in BST that it sets the times wrong by 1 hour.

    Please note that I do not want one of the new-fangled GUI programs, because I am using it within a BATch file.

    Thanks!
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Command-line TOUCH utility?

    What sets the value for "hh" in the Batch File?
    -John ... I float in liquid gardens
    UTC -7ąDS

  3. #3
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Command-line TOUCH utility?

    John, the full requirement is as follows:

    What I'm trying to do is to give file B the same (modified) date/time as file A.
    I find the date and time for file A using DIR.
    I then plug these parameters into TOUCH, operating on file B.
    When we're running on Greenwich Mean Time, the resulting date/time for file B are correct.
    When we're running on British Summer Time, the date/time for file B is an hour ahead of file A.

    I can program the BATch file to detect what "time" we're running, GMT or BST, and adjust hh (and occasionally dd, mm and yyyy!) accordingly -- but it's v. tedious, and would prefer a TOUCH utiility that works whether on "Standard" time or on "Daylight Saving Time".
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  4. #4
    Administrator
    Join Date
    Mar 2001
    Location
    St Louis, Missouri, USA
    Posts
    23,585
    Thanks
    5
    Thanked 1,059 Times in 928 Posts

    Re: Command-line TOUCH utility?

    John,
    Here's a link to a shareware program which may help DirDate

    Joe
    Joe

  5. #5
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Command-line TOUCH utility?

    Joe

    Looks fine -- but costs $20!

    I've found that the account I gave of TOUCH is not correct.

    What it gets wrong is the date/time by one hour when you are trying to set dates/times which lie WITHIN the Daylight Saving Time of your Time Zone.

    So the algorithm I'm now using is
    1. <LI>find the date/time of file A using DIR
      <LI>TOUCH file B with this date and time
      <LI>find the resulting date/time of file B
      <LI>if the two timestamps are the same, then "happiness has occurred" and we're done
      <LI>if the two timestamps are different, then calculate the date/time ONE HOUR BEHIND the date/time of file A and TOUCH file B with this earlier value
    All is now well... <img src=/S/fanfare.gif border=0 alt=fanfare width=31 height=23>

    And no determination is needed whether the computer is running on "Standard Time" or "Daylight Saving Time" (which, by the way, is a complete minefield with several Microsoft errors <img src=/S/bash.gif border=0 alt=bash width=35 height=39> even in the XP registry!)
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  6. #6
    Super Moderator
    Join Date
    Dec 2000
    Location
    Renton, Washington, USA
    Posts
    12,560
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Re: Command-line TOUCH utility?

    Check out "Set File Date" at http://no-nonsense-software.com/download.html

    Attribute Magic at http://Attribute Magic

    Or DAE at http://Attribute Magic


    One will find all kinds of <img src=/S/free.gif border=0 alt=free width=30 height=15>WARE at http://freewarehome.com/

    Now running HP Pavilion a6528p, with Win7 64 Bit OS.

  7. #7
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Command-line TOUCH utility?

    Thanks, Dave, but ... you appear to have missed the minor matter that I wanted a <font color=blue>command line program</font color=blue> running in a BATch file!!
    Most (if not all) of your suggestions are GUI-driven ... [pah!]
    [and why is there no smiley for [pah!], eh? [pah!]]

    PS GUIs are for WIMPs <img src=/S/pun.gif border=0 alt=pun width=22 height=18>
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  8. #8
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Command-line TOUCH utility?

    John (Dave?), that's why I asked what was setting the value of "hh"; Touch takes whatever value you give it, it doesn't know about the System Time or Daylight Savings. Seems like you have formulated a sufficiently convoluted algorithm, that should satisfy someone who doesn't like GUI's! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    -John ... I float in liquid gardens
    UTC -7ąDS

  9. #9
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Command-line TOUCH utility?

    My BAT file writing days are loooooooong behind me. <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>
    -John ... I float in liquid gardens
    UTC -7ąDS

  10. #10
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Command-line TOUCH utility?

    That makes TOUCH "PDU" for seven months of the year, then!

    If you know a better algorithm, please give it! <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>
    The finest scripting mind in the known universe <img src=/S/salute.gif border=0 alt=salute width=15 height=20> (that's not me, surprisingly!) hasn't come up with a better one...
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  11. #11
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Command-line TOUCH utility?

    Care to share trhe algorithm? Also, how are you detecting the state of Standard or Daylight time? Can you run a batch file called by autoexec on boot that does that detection and then Sets an Environmemnt Variable for DST=1 if Daylight savings is being observed, and then use that in your algorithm.
    -John ... I float in liquid gardens
    UTC -7ąDS

  12. #12
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Command-line TOUCH utility?

    By algorithm I meant the exact code you are using in the Batch file, though it appears that you may be using a mix of VBScript and BATch, and I know nothin' bout VBScript.
    -John ... I float in liquid gardens
    UTC -7ąDS

  13. #13
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Command-line TOUCH utility?

    The algorithm I'm using to set the date of file B to be the same as file A is several posts above, numbered 1 thru' 5! This indicates that I've abandoned the determination of whether my Time Zone is on Standard Time (GMT) or on Daylight Saving Time (BST), because the method in 1-5 renders it redundant.

    However, if, for other purposes, you wish to determine whether you're running on Standard or on Daylight time, you need to examine a key in the registry (HKLMSYSTEMCurrentControlSetControlTimeZoneInforma tion), a good way being to use REG QUERY, and find the values of two valuenames there: Bias and ActiveTimeBias. If their values are the same, then you're running on Standard Time; if different, then you're running on Daylight Time. An explanation of what all the various fields in this key mean can be found in Jerry Schulman's Tip 0398, but beware that the first field, Bias, is the "negative offset from GMT in MINUTES", not seconds, as he has there. If you wanted, you could of course include the BATch file that implements this in Startup. If you really want to use it, I'll send it to you!
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  14. #14
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Command-line TOUCH utility?

    John

    Do you want the BATch file to determine whether it's Standard Time or Daylight Time?
    Or the one to do the setting of the date/time of file B to be the same as that of file A?

    I'm not sure where we're getting to with this, since it's the work of five minutes to demonstrate what's going wrong with TOUCH, without necessarily using a BATch file, by:

    a) setting the PC date to (say) 12/12/2002 and then TOUCHING a file with any date within the Standard Time range, then with a date within the Daylight Time range, and doing DIR each time to see what the results were
    [img]/forums/images/smilies/cool.gif[/img] setting the PC date to (say) 06/06/2003, and doing the same TOUCHing/DIRing as in point a.
    By the way, don't try this at home, kids, if your machine has any important scheduled tasks on it, since they may get triggered unexpectedly...

    I've never, ever, used VBScript, never having found the need. The REG.EXE utility I refer to is in the NT4 and W2K Resource Kits, and even makes it into WINDOWSSYSTEM32 in WXP.

    Sadly, this doesn't seem to be getting me any closer to a TOUCH utility that actually works as it says on the tin...
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  15. #15
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Command-line TOUCH utility?

    Both BAT files, and I'm in no hurry and I'm not promising any brilliant ideas. It will just be fun to revisit some BAT coding again, and all the better that you are not using VBScrpt.
    -John ... I float in liquid gardens
    UTC -7ąDS

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •