Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hello...
I try to find some data with a batch in a list of 350 pages like this:directory of
O:\directory\13.09.01 21:18 7.846.390 1.TIF
13.09.03 21:22 1.647.616 2.TIFo:\dir\
13.09.01 21:15 18.296.710
4 Datei(en) 30.584.712 BytesAnzahl der angezeigten Dateien:
331 Datei(en) 3.123.111 Bytes 4.543.225.856 Bytes freeI need the second last line
and I need from some dates the full line; for example all of year 01.
I tried something like this in different versions:FOR /f "delims=" %%a in ('find "03" c:\3_3\speicherTif.txt') do echo %%a
But I doesnīt really work.
thanks for any help
uli

PLease, explain better your search criteria:
- what do you mean with "second last line"?
- what are the lines you like to retrieve with full data ?Sorry, but your post left me confusing.

with second last line I mean the line who shows how many files and how many bytes the files need when typing the dir command:
files :331 Datei(en) 3.123.111 Bytes
From this lines
13.09.01 21:18 7.846.390 1.TIF
13.09.03 21:22 1.647.616 2.TIFI want to search for example all of year 2001.
The reason is that we donīt have enough disk space so I want to find files wich are not used for longer time and burn it on CD and delete it from the file server.
With the DIR command I can just sort in every directory and have to check the list manually.The line that shows me how many bytes the files use, I need for statistic.
Sorry about my english
uli

Hi uli,
I am back and now I understand what you want to accomplish. The batch you find below should do the job, based upon your directives and lines sample. I tell you however the work could be fully automated and the reports better edited.
I tested the script using your sample, but if anytging goes wrong or you need more support post again.
To run type XScr FileName Year File_Out where FileName is your 350 pages list, year the Year and File-Out the file you want to hold the report (it may be CON or PRN i.e the screen and printer)
I hope this helps. Good work
@Echo Off
:: XSCR.BAT Syntax: XScr FileName Year File_Out
Echo.
If %1.==. (Echo File missing & GoTo :EOF)
If not exist %1 (Echo File "%~f1" not found & GoTo :EOF)
If %2.==. (Echo Year missing & GoTo :EOF)
If %3.==. (Echo Output missing & GoTo :EOF)Echo Screning "%~f1" for %2 - Output to "%~f3"
Echo Screning "%~f1" for %2 - Output to "%~f3" > %3
Echo. >> %3
For /F "tokens=1-3* delims=. " %%A in (%1) Do (
If "%%C"=="%2" Echo %%A.%%B.%%C %%D >> %3
If "%%B"=="Datei(en)" Echo %%A %%B %%C.%%D >> %3)
Echo Processing completed

Hi Ivo,
thanks a lot. It works great.
Just
If "%%B"=="Datei(en)" Echo %%A %%B %%C.%%D >> %3
doesnīt work. It seems to be the same problem
I had with with For....
"Datei (en)" is at the end of each directory listed. (There are many in the list)
I just need the last line with "Datei(en)"
in the list.
(thats what I meant with second last in the list. ;-) )
I just know how to ignore the first x lines if I know how many lines they are.
Is there a possibility to search the last line of "Datei (en)" ?greetings
uli

Hi uli,
To get only the last Datei line substitute in the script the lines starting with
If "%%B"=="Datei(en)" Echo %%A %%B %%C.%%D >> %3)
with the following
If "%%B"=="Datei(en)" Set Datei=%%A %%B %%C.%%D)
Echo. >> %3
Echo %Datei% >> %3
Echo.
Echo Processing completedThat catches only the last line of your interest.

![]() |
boot disk image
|
Additional DOS commands
|

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