Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi M2,
I know you're a guru with batch files & scripts. Before Windows XP, I used to have a batch file called "alltoday" When executed in DOS this batch will finds every files changed by drive letter and date/time of my choice. Unfortunately I no longer have this alltoday.bat. Is it possible to achieve the same readout with XP command prompt? If so I would greatly appreciate your help. Many thanks :-)
i_XpUser

Hi XPU,
Do you mean to either put a date on the command line or be prompted for one and then have the batch give you a list of all the files bearing that date?
Will the drives to check be hard-wired or does the batch need to figure that out?
If at first you don't succeed, you're about average.M2

Thanks for giving me a hand :-)
The default Alltoday.bat should be able to produce the list by current date and drive. Also optional parameters for any other date & drive letters will be helpful. I hope I've made my wish clear. If not holler at me :-) Thanks
i_XpUser

Hi XPU,
See if we're on the right track with this:
::== x3.bat ===== beta
:: find today's files
:: for this to work you need to know the date layout
:: if no command line parameter is given,
:: it checks the current drive and today's date
:: it will take one or two params: DATE and DRIVEl no colon
:: developed on a 2K box with file dates 21-02-2004
@echo off
if not %2'==' goto :2
if not %1'==' goto :1call :YMD6
set finddate=%DD%-%MM%-%YYYY%
dir \/s/a-d|find "%finddate%"
goto :eof:YMD6
:: get sys YMD into vars
@echo off
:: YYYY getter
> syyyy.d echo a 100
>> syyyy.d echo mov ah,2a
>> syyyy.d echo int 21
>> syyyy.d echo.
>> syyyy.d echo p=100 2
>> syyyy.d echo n sizeYYYY
>> syyyy.d echo w
>> syyyy.d echo q
debug < syyyy.d > nul
:: OK:: MM getter
> sMM.d echo a 100
>> sMM.d echo mov ah,2a
>> sMM.d echo int 21
>> sMM.d echo mov cx,0
>> sMM.d echo mov cl,dh
>> sMM.d echo.
>> sMM.d echo p=100 4
>> sMM.d echo n sizeMM
>> sMM.d echo w
>> sMM.d echo q
debug < sMM.d > nul
:: OK:: DD getter
> sDD.d echo a 100
>> sDD.d echo mov ah,2a
>> sDD.d echo int 21
>> sDD.d echo mov cx,0
>> sDD.d echo mov cl,dl
>> sDD.d echo.
>> sDD.d echo p=100 4
>> sDD.d echo n sizeDD
>> sDD.d echo w
>> sDD.d echo q
debug < sDD.d > nul
:: OK
del *.dfor %%F in (sizeYYYY sizeMM sizeDD) do call :sub1 %%F
set /p YYYY=<sizeYYYY.#
set /p MM=<sizeMM.#
if %MM% LSS 10 set MM=0%MM%
set /p DD=<sizeDD.#
if %DD% LSS 10 set DD=0%DD%
del size*.*
echo YYYYMMDD=%YYYY%%MM%%DD%
goto :eof:sub1
> %1.# echo %~z1
goto :eof
: DONE
If at first you don't succeed, you're about average.M2

Good morning M2 -
I believe something (maybe direct output to screen) must be missing from the batch file. When executed, it immediately output to screen YYYYMMDD=20060504 following by showing nothing else on the screen while completing the command. Thanks again :-)
i_XpUser

Hi XPU,
As per the notes at the top of the batch, you need to consider the layout of the date whin a DIR is done.
Paste a line or two of a DIR in your reply.
=====================================
If at first you don't succeed, you're about average.M2Go

This is the dir of my root drive for XP Home. I hope this is what you are asking.
Directory of c:\
11/13/2002 08:34 PM 0 AUTOEXEC.BAT
11/18/2005 07:12 AM 436 autorun.inf
11/13/2002 08:34 PM 0 CONFIG.SYS
12/24/2005 12:16 AM <DIR> Documents and S
11/18/2005 07:12 AM 528 02/23/2006 10:02 PM <DIR> Program Files
05/04/2006 05:48 AM <DIR> temp
12/29/2005 02:25 PM 1,537,983 wialog.txt
04/25/2006 04:30 PM <DIR> WINDOWS
05/04/2006 05:48 AM 1,538 x3.batI'm trying to get a grip on the batch processing. I used to do good with it during the days of DOS but that was long time ago and the batch processing has changed with XP.
i_XpUser

You need to change this:
set finddate=%DD%-%MM%-%YYYY%
to this:
set finddate=%MM%/%DD%/%YYYY%
=====================================
If at first you don't succeed, you're about average.M2Go

Done but still no effect. Can you review your repost the revised batch order from your post number 3? I think that because you suggest changing the set findate it mite have impact on the rest?
i_XpUser

OK, Try the bat below, and if you don't see this:
finddate=05/04/2006
something is haywire.
::== x4.bat
:: find today's files
:: for this to work you need to know the date layout
:: if no command line parameter is given,
:: it checks the current drive and today's date
:: it will take one or two params: DATE and DRIVEl no colon
:: developed on a 2K box with file dates 21-02-2004
@echo off
if not %2'==' goto :2
if not %1'==' goto :1call :YMD6
::set finddate=%DD%-%MM%-%YYYY%
set finddate=%MM%/%DD%/%YYYY%
echo finddate=%finddate%
pause
dir \/s/a-d|find "%finddate%"
goto :eof:YMD6
:: get sys YMD into vars
@echo off
:: YYYY getter
> syyyy.d echo a 100
>> syyyy.d echo mov ah,2a
>> syyyy.d echo int 21
>> syyyy.d echo.
>> syyyy.d echo p=100 2
>> syyyy.d echo n sizeYYYY
>> syyyy.d echo w
>> syyyy.d echo q
debug < syyyy.d > nul
:: OK:: MM getter
> sMM.d echo a 100
>> sMM.d echo mov ah,2a
>> sMM.d echo int 21
>> sMM.d echo mov cx,0
>> sMM.d echo mov cl,dh
>> sMM.d echo.
>> sMM.d echo p=100 4
>> sMM.d echo n sizeMM
>> sMM.d echo w
>> sMM.d echo q
debug < sMM.d > nul
:: OK:: DD getter
> sDD.d echo a 100
>> sDD.d echo mov ah,2a
>> sDD.d echo int 21
>> sDD.d echo mov cx,0
>> sDD.d echo mov cl,dl
>> sDD.d echo.
>> sDD.d echo p=100 4
>> sDD.d echo n sizeDD
>> sDD.d echo w
>> sDD.d echo q
debug < sDD.d > nul
:: OK
del *.dfor %%F in (sizeYYYY sizeMM sizeDD) do call :sub1 %%F
set /p YYYY=<sizeYYYY.#
set /p MM=<sizeMM.#
if %MM% LSS 10 set MM=0%MM%
set /p DD=<sizeDD.#
if %DD% LSS 10 set DD=0%DD%
del size*.*
echo YYYYMMDD=%YYYY%%MM%%DD%
goto :eof:sub1
> %1.# echo %~z1
goto :eof
:: DONE
=====================================
If at first you don't succeed, you're about average.M2Go

Hey M2 we're now getting somewhere with X4. It does produce a list of files timestamped with today's date. One thing is the readout omit the folder containing the files. I also would rather do without the "Press any key to continue" (pause). You did a fantastic job!
i_XpUser

Just wanna add - this is the first time I have seen so many files changed by XP itself - isn't that fascinating?
i_XpUser

The PAUSE is just to see if we're getting to first base.
So you want to get the folder names,too?
picky, picky
I'll work on it.
=====================================
If at first you don't succeed, you're about average.M2Go

Yes please we are really getting there :-) Have you seen anything like this - to get a list of every files timestamped by date. I am testing this on a machine that's not used for anything but Internet and I was stunned at the long list of files windows change :-)
i_XpUser

Hi XPU,
How we doin' so far?
::== XPU6.bat
:: find today's files
:: for this to work you need to know the date layout
:: if no command line parameter is given,
:: it checks the current drive and today's date
:: it will take one or two params: DATE and DRIVEl no colon
:: developed on a 2K box with file dates 21-02-2004
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::@echo off > outfile
if not %2'==' goto :2
if not %1'==' goto :1call :YMD6
set finddate=%MM%/%DD%/%YYYY%
echo finddate=%finddate%
for /f "tokens=*" %%D in ('dir \/s/ad/b') do call :sub1 %%D
goto :eof:sub1
echo %* >> outfile
dir "%*" | find "%finddate%" | find /v "<DIR>" >> outfile
goto :eof:YMD6
:: get sys YMD into vars
@echo off
:: YYYY getter
> syyyy.d echo a 100
>> syyyy.d echo mov ah,2a
>> syyyy.d echo int 21
>> syyyy.d echo.
>> syyyy.d echo p=100 2
>> syyyy.d echo n sizeYYYY
>> syyyy.d echo w
>> syyyy.d echo q
debug < syyyy.d > nul
:: OK:: MM getter
> sMM.d echo a 100
>> sMM.d echo mov ah,2a
>> sMM.d echo int 21
>> sMM.d echo mov cx,0
>> sMM.d echo mov cl,dh
>> sMM.d echo.
>> sMM.d echo p=100 4
>> sMM.d echo n sizeMM
>> sMM.d echo w
>> sMM.d echo q
debug < sMM.d > nul
:: OK:: DD getter
> sDD.d echo a 100
>> sDD.d echo mov ah,2a
>> sDD.d echo int 21
>> sDD.d echo mov cx,0
>> sDD.d echo mov cl,dl
>> sDD.d echo.
>> sDD.d echo p=100 4
>> sDD.d echo n sizeDD
>> sDD.d echo w
>> sDD.d echo q
debug < sDD.d > nul
:: OK
del *.dfor %%F in (sizeYYYY sizeMM sizeDD) do call :sub1 %%F
set /p YYYY=<sizeYYYY.#
set /p MM=<sizeMM.#
if %MM% LSS 10 set MM=0%MM%
set /p DD=<sizeDD.#
if %DD% LSS 10 set DD=0%DD%
del size*.*
echo YYYYMMDD=%YYYY%%MM%%DD%
goto :eof:sub1
> %1.# echo %~z1
goto :eof
:: DONE
=====================================
If at first you don't succeed, you're about average.M2Go

Hi M2,
I ran it using the default. It processed endless strings of "file not found". I terminated the batch with CTRL-V then the batch started to go into debug mode. Had to bring up task manager to terminate it. Not sure why but thanks nevertheless. I do appreciate your doing this as a favor for me :-)
i_XpUser

Hi XPU,
Not obvious where the snag is. This line:
dir "%*" | find "%finddate%" | find /v "<DIR>" >> outfile
[all one line]
Is using the directory name passed to it by the "for" as %* and doing a DIR and piping it to FIND.
The FIND is looking for the "%finddate%" which should have been set to today's date laid out to your DATE style; ie 05/05/2006. And then filtering out any instance of "<DIR>" so I don't know why you're seeing what you describe.
As a quick reality check, try at the prompt, using a directory which exists [so it's not processing the whole drive] try:
dir c:\temp | find "%finddate%" | find /v "<DIR>"
[that's one line]
I get output like this:
C:\temp\-
C:\temp\x
C:\temp\MK3
C:\temp\MK4
05-05-2006 01:45 290 D6.BAT
05-05-2006 04:33 1,740 X6.BAK
05-05-2006 01:47 292 D7.BAT#####
"then the batch started to go into debug mode"
Can you clarify that?
=====================================
If at first you don't succeed, you're about average.M2Go

![]() |
gmail changing extension ...
|
XP is pissing me off!
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |