check the contetns of two folders

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
express
Posts: 6
Joined: 24 Aug 2010 03:25

check the contetns of two folders

#1 Post by express » 27 Aug 2010 03:57

Hi folks

i am looking to check the contents of two (hopefully) identical folders on two different servers to check that they are identically replicated. i have tried the following

@echo off
set "data=P:\
set "arch=E:\filepath
set "log=E:\logfile.txt"

rem echo N| comp "%data%" "%arch%" 2>nul 1>nul &&echo Equal> "%log%" ||(
fc "%data%" "%arch%" >nul &&echo Equal> "%log%" ||(
echo Not equal> "%log%"
for %%a in ("%data%" "%arch%") do if "%%~za"=="0" echo Zero sized %%a>> "%log%"
)

but this just returns as them not being equal. P:\ is the mapped drive is there an easy way to use the full share path as i just get an empty log file when using \\server\filepath and \\server2\filepath do i need to put in a switch or anything?

thanks in advance

H

ghostmachine4
Posts: 319
Joined: 12 May 2006 01:13

Re: check the contetns of two folders

#2 Post by ghostmachine4 » 27 Aug 2010 05:09

you can download diffutils for windows, then do this

Code: Select all

c:\> diff c:\myfolder1 c:\myfolder2

express
Posts: 6
Joined: 24 Aug 2010 03:25

Re: check the contetns of two folders

#3 Post by express » 27 Aug 2010 05:19

the problem is they reside on different servers.
one folder is mapped to the other server so should be able to use P:\ and then E:\folder path

but it just returns an empty log.

is there string for all files contained within? i could try that after P:\?

Post Reply