Computing.Net > Forums > Disk Operating System > script in .bat file

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.

script in .bat file

Reply to Message Icon

Name: Mustafa
Date: March 20, 2003 at 06:00:44 Pacific
OS: windows 2000
CPU/Ram: pentium 3 / 326 MB
Comment:

Hello,
excuse my english.
what i tray to do is :
to connect some Servers on the D- Drive and look for a special File in a DATE and to find first :
was the BAckup successfully or incomplead ?

my way :
echo please give the searced Day in Form dd.mm.jj
set /P Datum=

FOR /F "tokens=1" %%i in (Serverliste.txt) do (
net use \\%%i\D$\ARCserve2000\LOG
dir \\%%i\D$\ARCserve2000\LOG /TW | findstr "J00" | findstr "%Datum%">Datum.txt
)
pause

FOR /F "tokens=1" %%k in (Datum.txt) do (
findstr "Succesfull" >Successfull.txt
)

but it does not work !

Please help me



Sponsored Link
Ads by Google

Response Number 1
Name: Secret_Doom
Date: March 20, 2003 at 14:12:12 Pacific
Reply:

I miss the logic of the script, I mean, it's not a source trouble like mispelled cmd or anything, it's just that it shouldn't work anyway - you first get the lines from the dir listing which have the specified date to a text file. Then, you look for the string 'Succesful' on that file. Why do you expect that file (datum.txt) do have the strings 'Sucessfull'?

I'm not even sure of what you're trying to do here... Anyway, the following script will find the files on a certain directory (that LOG folder based on the server list) with extention .J00 that were written on the inputed date, and display them. If no files were found, it will display the messages "No files found":

@echo off
if exist %0.bat %0.bat
setlocal
set Datum=
for %%F in (%0) do (
    for /F "tokens=1" %%D in ("%%~tF") do (
        set Gauge=%%D
    )
)
echo Enter write date of files to be found in format as example - %Gauge%
:input
set /P Datum=
if "%Datum%"=="" goto input
set found=0

for /F "tokens=1" %%S in (Serverliste.txt) do (
    net use \\%%S\D$\ARCserve2000\LOG
    for %%F in (\\%%S\D$\ARCserve2000\LOG\*.J00) do (
        for /F "tokens=1" %%D in ("%%~tF") do (
            if "%%D"=="%DATUM%" (echo %%F&set found=1)
        )
    )
)

if "%found%"=="0" echo File not found.
endlocal

I hope that helps you.

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br

_______________________________________________________________________________


0

Response Number 2
Name: Mustafa
Date: March 21, 2003 at 02:32:08 Pacific
Reply:

Thanks !!

it was realy helpfull .


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Making a .bat file to get... DOS and Win 2k partition



Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: script in .bat file

Printing in bat files www.computing.net/answers/dos/printing-in-bat-files/12009.html

if/then in bat file www.computing.net/answers/dos/ifthen-in-bat-file/13907.html

How to create LOG in BAT file www.computing.net/answers/dos/how-to-create-log-in-bat-file/12481.html