PC Review


Reply
Thread Tools Rate Thread

How to compare two directories?

 
 
Anon E. Mouse
Guest
Posts: n/a
 
      18th Sep 2009
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.
 
Reply With Quote
 
 
 
 
Pegasus [MVP]
Guest
Posts: n/a
 
      18th Sep 2009

"Anon E. Mouse" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.


 
Reply With Quote
 
Anon E. Mouse
Guest
Posts: n/a
 
      18th Sep 2009
Pegasus [MVP] wrote:
> "Anon E. Mouse" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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.
>
>

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.
 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a
 
      18th Sep 2009

"Anon E. Mouse" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Pegasus [MVP] wrote:
>> "Anon E. Mouse" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> 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.

> 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.


 
Reply With Quote
 
Twayne
Guest
Posts: n/a
 
      19th Sep 2009

"Anon E. Mouse" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)
> 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.


 
Reply With Quote
 
Kelly
Guest
Posts: n/a
 
      19th Sep 2009
That was good! )

--

All the Best,
Kelly (MS-MVP/DTS&XP)

Taskbar Repair Tool Plus!
http://www.kellys-korner-xp.com/taskbarplus!.htm


"Pegasus [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> "Anon E. Mouse" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Pegasus [MVP] wrote:
>>> "Anon E. Mouse" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> 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.

>> 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.
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to compare two directories using File Checksum Integrity Verif Don Anderson Windows XP General 9 25th Jan 2010 03:57 AM
How to compare contents of two folders (directories)? Clueless in Seattle Microsoft Windows 2000 File System 2 4th May 2007 12:24 AM
Compare two directories Peter Larsen [] Microsoft Dot NET 8 9th Aug 2006 09:35 AM
Util soft: to compare directories by size, name but not time stamp? lbbss Freeware 5 8th Sep 2005 08:31 PM
xcopy and compare two directories nevje Microsoft Windows 2000 3 20th Jul 2004 10:23 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:41 PM.