Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch    |    Fun with MS-DOS batch files    |    42,547 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 41,698 of 42,547    |
|    JJ to pyotr filipivich    |
|    Re: I want to test: if a file date is "t    |
|    01 Mar 19 23:42:19    |
      From: jj4public@vfemail.net              On Thu, 28 Feb 2019 08:45:45 -0800, pyotr filipivich wrote:       > Greetings       >       > There are three user accounts on the machine: Fred, Bob, and Greg.       > I already have a batch file which loops through the Userlist "Fred Bob       > Greg" to copy today's files to a thumbdrive.       > Realizing that Fred and Greg do not get used everyday, I would       > like to be able to check if they did anything before starting the       > loop. Looking around, I see that Bob's ntuser.dat has today's date if       > Bob logged in today.       > So, is there a way to get the date of that file?       >       > Oh nerts. I just tried something, and form the command line -       > ntuser.dat is invisible. Being a System, Hidden file, unless I first       > run       > attrib -s -h       > command-line won't see it.       >       > (I'm back - I should do my experimentation before I compose this       > post, not while.)       > Anyway, changing the attributes of ntuser.dat does not braek       > anything, but because the file is In Use, I can't copy it. But       > DIR ntuser.dat > Net-Date.txt       > works.       > FIND "02/18" net-date.txt       > works as well.       >       > And Errorlevel tells me if 02/18 is found or not.       >       > Now all I need to do is work out how to get today's date into a       > format to use as a search term.       >       > thanks       >       > pyotr              Use this.              @echo off       setlocal enabledelayedexpansion       set file="c:\file\to\check.txt"       set samedate=0       for %%A in (%file%) do (        set d=%%~tA        if "!d:~0,10!" == "%date%" set samedate=1       )       if %samedate% == 1 echo File date is today.              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca