How to compare two directories?

  • Thread starter Thread starter Anon E. Mouse
  • Start date Start date
A

Anon E. Mouse

I've copied a large directory tree from my machine to an external disk.
I'd like to verify that everything copied accurately. How can I do that?

The "fc" command works well, but it doesn't have a switch that will do
subdirectories.

I'm thinking that some combination of the "for" command and fc will do
it, but the syntax of for is escaping me.
 
Anon E. Mouse said:
I've copied a large directory tree from my machine to an external disk.
I'd like to verify that everything copied accurately. How can I do that?

The "fc" command works well, but it doesn't have a switch that will do
subdirectories.

I'm thinking that some combination of the "for" command and fc will do it,
but the syntax of for is escaping me.

Here you go:

@echo off
SetLocal EnableDelayedExpansion
set SourceDir=d:\logs
set TargetDir=e:\Test

for /F "delims=" %%a in ('dir /s /b "%SourceDir%"') do (
set Name=%%a
for %%b in ("!Name!") do (
echo fc "%%~db%%~pb%%~nb%%~xb" "%TargetDir%%%~pb%%~nb%%~xb"
)
)

Remove the word "echo" in the third line from the bottom to activate the
batch file.
 
Pegasus said:
Here you go:

@echo off
SetLocal EnableDelayedExpansion
set SourceDir=d:\logs
set TargetDir=e:\Test

for /F "delims=" %%a in ('dir /s /b "%SourceDir%"') do (
set Name=%%a
for %%b in ("!Name!") do (
echo fc "%%~db%%~pb%%~nb%%~xb" "%TargetDir%%%~pb%%~nb%%~xb"
)
)

Remove the word "echo" in the third line from the bottom to activate the
batch file.
Thank you. This is excellent. And posted in only 20 min!

Output is a bit verbose, so I have to pipe it to a file.
 
Anon E. Mouse said:
Thank you. This is excellent. And posted in only 20 min!

Output is a bit verbose, so I have to pipe it to a file.

Thanks for the feedback.
 
Anon E. Mouse said:
I've copied a large directory tree from my machine to an external
disk. I'd like to verify that everything copied accurately. How can I
do that?
The "fc" command works well, but it doesn't have a switch that will do
subdirectories.

I'm thinking that some combination of the "for" command and fc will do
it, but the syntax of for is escaping me.

Open 2 instances of Explorer and put them side by side.
 
Back
Top