View Single Post
Old 06-16-2009, 10:51 AM   #1 (permalink)
Neablis
Registered User
 
Join Date: Jun 2009
Posts: 4
OS: Windows 7


Creating batch file to Check Directories

Hello. Im trying to make a batch file that goes through two directors and writes to a txt document all the files that exist in one that dont exist in the other. I have it ALMOST working but i cant figure out how to get it to go down in folders to compare the rest of the directory. Any he[lp would be nice, THANKS!

Code:
@echo off

setlocal ENABLEDELAYEDEXPANSION

Set dirA=%1
Set dirB=%2

dir /B /O %dirA% >dirA.txt
dir /B /O %dirB% >dirB.txt

Echo. >>AnotinB.txt
find /V /C "this_is_an_absurd_string" dirB.txt >numlines.txt
for /f "tokens=3 delims= " %%B in (numlines.txt) do set /A maxnum=%%B

for /F "tokens=* delims= " %%A in (dirA.txt) do (
find /V /C "%%A" dirB.txt >numlines.txt
for /f "tokens=3 delims= " %%B in (numlines.txt) do set /A foundnum=%%B
if %maxnum%==!foundnum! echo %%A >>AnotinB.txt
)


copy /B AnotinB.txt dupli.txt >nul
more dupli.txt

for %%A in (dirA.txt dirB.txt AnotinB.txt numlines.txt) do (
if exist %%A del %%A
)
Neablis is offline   Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here