Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hi all,
I am making a batch file in which i have a mode where i am comparing total files from source to destination. both source and destinations are on different servers. so i just have used simple dir /b commands to show files on screen. but the problem is there are many files which creates problem while comparing. is there any way by which i can show those files including source and destination in TABLE format?
let me explain giving example like
echo files from source server
dir /b \\server1\logs
echo.
echo files from destination server
dir /b \\server2\<current date>\logsoutput comes like:
files from source server
fil1.log
fil1.log
fil1.log
fil1.log
fil1.logfiles from destination server
fil1.log
fil1.log
fil1.log
fil1.log
fil1.logwhat i want to make is like this
files from source server files from destination server
fil1.log fil1.log
fil1.log fil1.log
fil1.log fil1.log
fil1.log fil1.log
fil1.log fil1.logis it possible?
K2™
System/Network Engineer

Hi alwaysk2
@echo off
for /f %%a in ('dir F1\*.* /b') do (
if exist F2\%%a (
for /f %%b in ('dir F2\%%a /b') do (echo %%a %%b)
) else (echo %%a Not Found)
)

hi dtech,
thanx a lot for your reply.
but the problem is when i am giving this kind of batch file:
=======================
@echo off
for /f %%a in ('dir \\server1\logs\*.* /b') do (
if exist \\server2\<current date>\logs\%%a (
for /f %%b in ('dir \\server2\<current date>\logs\%%a /b') do (echo %%a %%b)
) else (echo %%a Not Found)
)
==============its having some files (approx 6 files) which have names like 08182008_missing information.log, so this files always shows "FILE NOT FOUND" and the rest files are showing. can you suggest me why it is giving this kind of error or is it related to 8 character DOS names which is generating errors?
K2™
System/Network Engineer

Hi
Do see why the filename should cause a problem, but try this incase it's to do
with names with spaces in them.@echo off
for /f "tokens=*" %%a in ('dir F1\*.* /b') do (
if exist F2\"%%a" (
for /f "tokens=*" %%b in ('dir F2\"%%a" /b') do (echo %%a %%b)
) else (echo %%a Not Found)
)

![]() |
Search and Replace
|
Hide/Unhide Program via S...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |