Computing.Net > Forums > Windows XP > For Mechanix2Go

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

For Mechanix2Go

Reply to Message Icon

Name: XpUser
Date: May 3, 2006 at 17:37:31 Pacific
OS: XP Home & PRO All SP2
CPU/Ram: 2.02GHz/512RAM
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: May 3, 2006 at 18:33:37 Pacific
Reply:

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


0

Response Number 2
Name: XpUser
Date: May 3, 2006 at 19:18:56 Pacific
Reply:

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


0

Response Number 3
Name: Mechanix2Go
Date: May 4, 2006 at 02:09:36 Pacific
Reply:

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 :1

call :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 *.d

for %%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


0

Response Number 4
Name: XpUser
Date: May 4, 2006 at 03:47:20 Pacific
Reply:

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


0

Response Number 5
Name: Mechanix2Go
Date: May 4, 2006 at 06:27:34 Pacific
Reply:

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



0

Related Posts

See More



Response Number 6
Name: XpUser
Date: May 4, 2006 at 06:39:14 Pacific
Reply:

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.bat

I'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


0

Response Number 7
Name: Mechanix2Go
Date: May 4, 2006 at 06:47:02 Pacific
Reply:

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



0

Response Number 8
Name: XpUser
Date: May 4, 2006 at 06:55:15 Pacific
Reply:

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


0

Response Number 9
Name: Mechanix2Go
Date: May 4, 2006 at 07:30:38 Pacific
Reply:

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 :1

call :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 *.d

for %%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



0

Response Number 10
Name: XpUser
Date: May 4, 2006 at 07:40:01 Pacific
Reply:

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


0

Response Number 11
Name: XpUser
Date: May 4, 2006 at 07:49:00 Pacific
Reply:

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

i_XpUser


0

Response Number 12
Name: Mechanix2Go
Date: May 4, 2006 at 08:26:31 Pacific
Reply:

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



0

Response Number 13
Name: XpUser
Date: May 4, 2006 at 08:34:12 Pacific
Reply:

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


0

Response Number 14
Name: Mechanix2Go
Date: May 4, 2006 at 14:35:49 Pacific
Reply:

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 :1

call :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 *.d

for %%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



0

Response Number 15
Name: XpUser
Date: May 4, 2006 at 15:40:16 Pacific
Reply:

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


0

Response Number 16
Name: Mechanix2Go
Date: May 5, 2006 at 01:54:58 Pacific
Reply:

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



0

Sponsored Link
Ads by Google
Reply to Message Icon

gmail changing extension ... XP is pissing me off!



Post Locked

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


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: For Mechanix2Go

files with date stamp www.computing.net/answers/windows-xp/files-with-date-stamp/169907.html

Date code www.computing.net/answers/windows-xp/date-code/170025.html

Formatting problems www.computing.net/answers/windows-xp/formatting-problems/175404.html