Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: datestamp help  (Read 6393 times)

0 Members and 1 Guest are viewing this topic.

Salmon Trout

  • Guest
Re: datestamp help
« Reply #15 on: September 22, 2010, 01:49:12 PM »
Are you sure, as you showed before, that there is a leading zero in the file date?

What does this show?

Code: [Select]
@echo off
setlocal enabledelayedexpansion
set foldername="Your folder"
REM get file date of all files in folder
for /f "delims=" %%A in ( ' dir /b /a-d /od %foldername% ' ) do (
set fdate=%%~tA
echo !fdate!
)
pause

x3g

    Topic Starter


    Rookie

    Re: datestamp help
    « Reply #16 on: September 22, 2010, 01:52:04 PM »
    no hidden files. No file dated today.

    Salmon Trout

    • Guest
    Re: datestamp help
    « Reply #17 on: September 22, 2010, 01:52:58 PM »
    Are you sure, as you showed before, that there is a leading zero in the file date?

    What does this show?

    Code: [Select]
    @echo off
    setlocal enabledelayedexpansion
    set foldername="Your folder"
    REM get file date of all files in folder
    for /f "delims=" %%A in ( ' dir /b /a-d /od %foldername% ' ) do (
    set fdate=%%~tA
    echo !fdate!
    )
    pause


    x3g

      Topic Starter


      Rookie

      Re: datestamp help
      « Reply #18 on: September 22, 2010, 01:53:26 PM »
      windows does not display the leading 0 but DOS does.

      Salmon Trout

      • Guest
      Re: datestamp help
      « Reply #19 on: September 22, 2010, 01:55:17 PM »
      so what does my test script show?

      x3g

        Topic Starter


        Rookie

        Re: datestamp help
        « Reply #20 on: September 22, 2010, 01:58:04 PM »
        ECHO is off.
        09/22/2010 09:46 AM
        09/22/2010 01:11 PM
        Press any key to continue . . .

        that's weird cause these files are dated 9/21 if I do a DIR


        C:\test\1>dir
         Volume in drive C has no label.
         Volume Serial Number is E40F-A8C4

         Directory of C:\test\1

        09/21/2010  05:04 PM    <DIR>          .
        09/21/2010  05:04 PM    <DIR>          ..
        09/21/2010  05:05 PM               359 CurrDate.bat
        09/21/2010  05:05 PM                17 notepad.bat
        09/21/2010  05:02 PM               716 test.txt
                       3 File(s)          1,092 bytes
                       2 Dir(s)  116,920,819,712 bytes free

        C:\test\1>

        x3g

          Topic Starter


          Rookie

          Re: datestamp help
          « Reply #21 on: September 22, 2010, 02:05:26 PM »
          Salmon,
          I think I've found the culprit. I made a copy of a file dated 9/21 and updated it in another folder but somehow the original file which is dated 9/21 is still linked to the copy and the copied file is dated 9/22. Even though they are in 2 separate locations the script still picks up the date of the copy.
          I created a whole new folder and copied 2 files from 9/21 and the script works like a charm.
          thank you very much for your help. You're a hero.

          Salmon Trout

          • Guest
          Re: datestamp help
          « Reply #22 on: September 22, 2010, 02:05:36 PM »
          possibly the script is picking up the creation date and DIR is picking up the modified date i.e.when they were moved.

          try adding the /tC or /tA or /tW switches (only one at a time) both in the script and with DIR at the prompt

          eg DIR /tC

          or else...

          1. when did you last do a disk check?

          2. Is this a network folder?







          Salmon Trout

          • Guest
          Re: datestamp help
          « Reply #23 on: September 22, 2010, 02:06:38 PM »
          Our posts crossed... glad it's OK now... I'm here if it goes wrong...