Check report files in directories

M

Mikhail

hi,

I have a report that needs to be check in directories. The
format of the report is something like this:

report1 - File1 (done)
File2
report2 - File3 (done)
report2 - File4 (Pending)
- File5
etc.


How can I check if the files (File1 to File5) in the
report exist in the directories. How can I eliminate the
characters before and after the filenames. My idea is to
create a list then use for /f "Tokens=*" %%a in
(c:\report1.txt) echo %%a >> report2.txt to make another
report then check the files in the directories.

output of report1.txt is

File1
File2
File3
File4
File5

any other ideas?

thanks in advance,

Mikhail
 
F

foxidrive

I have a report that needs to be check in directories. The
format of the report is something like this:

"something like this" is seldom accurate anough - it would be far better to
see a genuine sample file.
 
J

Jerold Schulman

Assuming that each dile has a dash in front and that
their is never a space in the file name and the report is
in a fix format (the file names line up), I will make believe that
the file names start in column 35:

setlocal ENABLEDELAYEDEXPANSION
for /f "Tokens=*" %%a in ('type report.txt^|findstr /c:"-"') do (
set line=%%a
set work=!line:~34!
for /f "Tokens=1" %%b in ('@echo !work!') do (
set file=%%b
if not exist !file! @echo File !file! not found.
)
)





hi,

I have a report that needs to be check in directories. The
format of the report is something like this:

report1 - File1 (done)
File2
report2 - File3 (done)
report2 - File4 (Pending)
- File5
etc.


How can I check if the files (File1 to File5) in the
report exist in the directories. How can I eliminate the
characters before and after the filenames. My idea is to
create a list then use for /f "Tokens=*" %%a in
(c:\report1.txt) echo %%a >> report2.txt to make another
report then check the files in the directories.

output of report1.txt is

File1
File2
File3
File4
File5

any other ideas?

thanks in advance,

Mikhail


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top