Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Hatsukaichi, Hiroshima, Japan
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Modifying File Dates for Shorcuts (XP Pro SP2)

    Hello, is there any way to change the modified date of a Window's shortcut? I downloaded tweak 83 from Kelly's Korner but when I tried it on a shortcut it went straight to the file itself. Alternatively, does anyone know of a way to create shortcuts that use the date information from the original file?

    The reason I'm interested in shortcuts suddenly is that I can create project folders using shortcuts rather than copies of the original file. I often use some files in more than one project. Previously I would just copy the file but often I end up with several versions of the same file and I need to spend time compiling changes. If I keep the master file in one place and use shortcuts for my projects I'll avoid the multiple version problem. If I create a bunch of shortcuts in one go, they will all have the same creation date and be impossible to sort by date, hence my desire to have the shortcut reflect the original file's creation date.

    Hope this makes sense!

    Thanks,

    Chris (Hunt)

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

    Re: Modifying File Dates for Shorcuts (XP Pro SP2)

    Chris

    I'd approach it with a BATch file (surprise!), which found the (modified) date and time of the original file using DIR and passed that to one of the timestamp modifying programs like TOUCH (from almost any of the NT Resource Kits) to apply to the shortcut file. More details required of filename formats, directories, and so on if you want me to look at it.

    I haven't come across anything which does precisely what you want when creating the shortcut; Marty List's (OptimumX) SHORTCUT program seems to have no such option.

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

    Ita, esto, quidcumque...

  3. #3
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Hatsukaichi, Hiroshima, Japan
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Modifying File Dates for Shorcuts (XP Pro SP2)

    Thanks for the reply, John. From the little I could find out about touch.exe it changes the date to the current date. I couldn't see how to use it to transfer the date from one file to another. The files I want to make shortcuts for are word and text files. The txt files are all in one folder (F:TXT files) and the word files are separated according to their starting letter, eg, F:Word Files A-ZWord Documents A, F:Word Files A-ZWord Documents B etc. If you can give me any pointers on how to use touch.exe that would be great, but are there different versions? The one I tried using was from: here.

    Chris

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

    Re: Modifying File Dates for Shorcuts (XP Pro SP2)

    Chris

    No, the version of TOUCH I was referring to comes from the Microsoft NT 4 Resource Kits:
    TOUCH:
    Usage: TOUCH [/t year month day hour min sec] files

    The 'latest' one is about 91KB and is dated 1996.

    Please could you do me a DIR of a couple of the TXT files (with day values greater than 12!!) and their corresponding shortcuts, so I can see the date format your machine is set to, and I'll see what I can do. I really hope you work on the 24-hour clock system, because otherwise the amount of BATch code may have to double (unless I set the times to 01:01:01...).

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

    Ita, esto, quidcumque...

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

    Re: Modifying File Dates for Shorcuts (XP Pro SP2)

    Chris

    Here is my attempt at the BATch file, assuming that you are using the UK date and time format
    dd/mm/yyyy hr:mn
    Since the order of specification of the date fields, the date (and perhaps time) separators, and the 24-hour or 12-hour (with am/AM and pm/PM suffices) is critical to the operation of the BATch file, it would have to be modified for non-UK date/time formats. (You can make it universal, but it's not worth the bother...)<pre>@echo off
    :: +---------+
    :: I RESTAMP I change shortcut files' timestamp to match the actual files
    :: +---------+

    :: this BATch file should be in the relevant directory to be processed
    :: and the NT4 ResKit TOUCH.EXE should be in a directory in the PATH

    :: assumed format of output from DIR is in the UK DATE FORMAT as follows:
    :: dd/mm/yyyy hr:mn filesize filename which may have blanks.txt (or .doc)
    :: 24 hr, no AM or PM

    setlocal

    :: process each of the possible extensions in turn
    for %%a in (txt doc) do call :dothisext %%a
    endlocal
    goto :eof
    ::----------------------------------------------------------------

    :dothisext parameter %1 is the current extension, txt or doc
    if not exist *.%1 echo %~n0: no files with extension %1 & goto :eof

    :: do a directory list and find each line with .[ext] at the end
    set forcmds=dir *.%1 ^^^| findstr /i /c:.%1
    for /f "tokens=1-6* delims=/: " %%a in ('%forcmds%') do (
    rem we are losing the size value by omitting %%f
    call :stamper %%a %%b %%c %%d %%e "%%g"
    )
    goto :eof
    ::----------------------------------------------------------------

    :stamper parameters dd mm yyyy hr mn "filename.ext" for current file
    :: %1 %2 %3 %4 %5 %6

    :: remove the double-quotes from the filename
    set filename=%~6
    :: and the .ext extension (whatever it is)
    set filename=%filename:~0,-4%

    :: run TOUCH on the Shortcut file with date/time info from the actual file
    :: (remove the words ECHO and PAUSE when operation has been checked)
    ECHO touch /t %3 %2 %1 %4 %5 00 "Shortcut to %filename%.lnk"
    PAUSE
    goto :eof</pre>


    If you want me to take it further, please post the DIR output requested in my previous post.

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

    Ita, esto, quidcumque...

  6. #6
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Hatsukaichi, Hiroshima, Japan
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Modifying File Dates for Shorcuts (XP Pro SP2)

    Thanks John, it makes my head spin! I can kind of understand what you have done but how you did it I've no idea! From looking at what you wrote the BATch file should be in the same directory as the files to be processed. Should the shortcut and the original file be in the same directory? As you suspected I am using the British date format and the 24 hour clock. Both directory and file names include blanks. What would be a good way to capture the information from doing DIR? A screen capture, or is there a better way? Thank you for helping me with this.

    Best wishes,

    Chris

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

    Re: Modifying File Dates for Shorcuts (XP Pro SP2)

    <P ID="edit" class=small>(Edited by JohnGray on 21-Oct-06 16:34. )</P>Chris

    I have assumed that
    the shortcuts to the files (those called "Shortcut to File Name.lnk" or "Shortcut to Different File Name.lnk"), and
    the files themselves (those called "File Name.txt" or "Different File Name.doc"),
    are in the same directory, because wasn't that what you wanted some time back? You will have to give me a LOT more detail if this is not the case....

    Please confirm that the shortcut name is formed from the original filename by adding "Shortcut to " to the front of the filename, and replacing the TXT or DOC extension by LNK, as shown in the previous paragraph...

    Make sure you put the correct TOUCH.EXE into the system path (e.g. into the C:WINDOWS directory - you can always move it out later).

    The easiest way is to do a test is to copy the BATch file into a directory which has just a few files, and double-click on it. Observe the ECHOed TOUCH command and its parameters, which should say something like
    <big>touch /t yyyy mm dd hr mn 00 "Shortcut to My Filename with blanks in it.lnk"</big>
    (all the parameters are sensible date/time numbers) for each file, pressing Enter at each PAUSE.

    When you are happy that the output "looks right", remove the capitalised words ECHO and PAUSE from the bottom of the BATch file (use Notepad or Edit, not Open!) and it should be ready to go. Observe the output in one directory, and see if it's correct. Then move the BATch file to each directory in which you want the shorcut date/time information updated, and double-click on it. Hope it works OK...

    My way of getting the DIR information is to do
    DIR *.TXT > $$.TXT & NOTEPAD $$.TXT & DEL $$.TXT (careful...!)
    in a Command Prompt Window, then cut-and-paste from Notepad into the Lounge post. But if you are using British date/time format, the BATch file should work as coded! <img src=/S/crossfingers.gif border=0 alt=crossfingers width=17 height=16>

    Good luck!

    John

    PS Edited to give the shortcut files the correct LNK extension, and to add the second paragraph!
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  8. #8
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Modifying File Dates for Shorcuts (XP Pro SP2)

    Do you know if Microsoft makes TOUCH.EXE available as a free download? I understand it's available on a Resource Kit CD, but wasn't able to find it as a download.

  9. #9
    Uranium Lounger
    Join Date
    Mar 2001
    Location
    New Jersey
    Posts
    6,684
    Thanks
    1
    Thanked 11 Times in 11 Posts

    Re: Modifying File Dates for Shorcuts (XP Pro SP2)

    <IMG SRC=http://www.wopr.com/w3tuserpics/DocWatson_sig.gif>

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Modifying File Dates for Shorcuts (XP Pro SP2)

    FYI:
    <hr>Written by Helge Klein, 2002<hr>
    Although I assume it does the same, this is not the Microsoft utility.

  11. #11
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Modifying File Dates for Shorcuts (XP Pro SP2)

    Thanks for the prompt reply. I had already found several 3rd-party "touch" utilities on the web, but I was hoping for a copy of Microsoft's. Should I assume from your post that Microsoft's utility isn't freely available?

    I should probably add that I have Microsoft's Server 2003 Resource Kit Tools (a free download that includes, among many other utilities, Robocopy), but it doesn't include Touch.

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Modifying File Dates for Shorcuts (XP Pro SP2)

    Since July 1, 2005, Windows 2000 is in its 'Extended Support Phase', meaning (among other things) that many of the free downloads aren't available any more.

  13. #13
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Hatsukaichi, Hiroshima, Japan
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Modifying File Dates for Shorcuts (XP Pro SP2)

    Hi, I couldn't get the version by Helge Klein to work with John's Stamper BATch file but the one from <A target="_blank" HREF=ftp://ftp.microsoft.com/Services/TechNet/samples/PS/Win98/Reskit/FILE/>here</A> does. It appears to be from the Windows 98 Resource kit..

    Chris

  14. #14
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Modifying File Dates for Shorcuts (XP Pro SP2)

    Nicely done! I don't know how you found that ftp folder, but thanks for passing on the link.

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

    Re: Modifying File Dates for Shorcuts (XP Pro SP2)

    Chris

    I'm glad it did what you want even though the specifications were not quite right. If you are going to need to use it again, please let me know so that I can change the shortcut format from "Shortcut to Letter to Joe Bloggs.lnk" to "Letter to Joe Bloggs.doc.lnk". In fact it makes the BATch file slightly simpler...

    Your problem with your post repeating part of itself is because of the little-known Lounge requirement that all % signs when posted should be enclosed within square brackets, as in [%], so that it doesn't think that the data represents hexadecimal values or commands. Sometimes you can get away with it, but it depends on what directly follows the % sign. It's what Microsoft calls "a feature"!

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

    Ita, esto, quidcumque...

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
  •