I need to compare .tif and .xml files

October 9, 2010 at 08:26:54
Specs: Windows XP
I have created a script to move xml and tif files to another direcctory to be picked up by another program. I need to add a step to validate that there is a tif for every xml and xml for every tif before moving. I am thinking of maybe directory pipe of xml and tif files with a file compare, and copying out any that do not match first before I proceed with what I already have? This is what I currently have that works without the validation.

@echo off
FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B
FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%B
FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%B
FOR /F "TOKENS=2,3 DELIMS=/ " %%A IN ('echo %CDATE%') DO SET yyyy=%%B
SET date=%yyyy%-%mm%-%dd%
md Z:\NewFolder\archive\%date%
y:
cd Y:\MyDirectory
IF EXIST *.tif (
copy Y:\MyDirectory\*.* Z:\NewFolder\archive\%date%
move Y:\MyDirectory\*.xml Z:\NewFolder\pickup\
move Y:\MyDirectory\*.tif Z:\NewFolder\pickup\
blat -body "Files Copied'." -s " Files Copied" -server smtprelay.company.com -f mailbox@company.com -t imailbox@company.com
) ELSE (
blat -body "No Files to Copy'." -s "No Files to Copy" -server smtprelay.company.com -f mailbox@hcompany.com -t imailbox@company.com
)


See More: I need to compare .tif and .xml files

Report •

#1
October 10, 2010 at 06:19:18
I am thinking of maybe directory pipe of xml and tif files with a file compare, and copying out any that do not match first before I proceed with what I already have?
I'm thinking that's too much work.
for %%a in (*.xml) do if not exist "%%~Na.tif" echo %%~Na.tif missing.
for %%a in (*.tif) do if not exist "%%~Na.xml" echo %%~Na.xml missing.

How To Ask Questions The Smart Way


Report •

#2
October 10, 2010 at 20:49:42
I like your thinking!! That was so much better than what I was trying to do or was expecting. Thank you so much!

Report •

#3
October 12, 2010 at 17:46:49
Hi Razor2.3!
I just realized that this will only write one of the files that are different. If there is more than one per type it ignores the rest. Do I need to somehow make it loop or do while?

Report •

Related Solutions

#4
October 12, 2010 at 17:50:47
It looks like it is only showing the last one it wrote, so maybe previous lines are overwritten? Is there an append command?

Report •

#5
October 14, 2010 at 08:55:07
I'm not sure what you're doing; my example doesn't write anything to any file.

How To Ask Questions The Smart Way


Report •

Ask Question