computing
  • 11

Solved Batch Script To Find Files In Folder And Subfolders

  • 11

Hi,

I am completely new to this and would appreciate any help.
I have a .txt file that contains a list of file names. I need a batch script that will reference this list of file names and search through a folder and it’s subfolders to find them. I then need it to generate a .txt that lists those files not found.

It seems like this question has been answered partially before on other posts but not exactly how I need it done and I’m having trouble modifying other scripts to fit my issue.

Thanks.

Share

1 Answer

  1. @echo off & setlocal enabledelayedexpansion
    type nul> %tmp%\log.txt
    set log=%tmp%\log.txt
    set list=C:\Users\Username\Documents\Lists\lists.txt
    set cnt=0
    set number=0
    for /f “delims=” %%a in (‘type %list%’) do (
    set /A cnt +=1
    set file!cnt!=%%a
    )
    X:
    cd X:\CountyLTmaps\Texas\Grimes\Lease Images
    :LOOP
    if %number%==%cnt% exit /b
    set /A number +=1
    dir /s !file%number%! || echo.!file%number%!>> %tmp%\log.txt
    Goto :LOOP
    • 0