I have two folders on my hard drive A and B. I want to compare all files in B to A. Any file thats in B and not in A, shall be copied into a third folder C. All this to be done in the batch. I want to keep A , B and C as variables so set A=C:/A for example.
One little twist is that I can not compare all of B/*.* to A/*.* using the filenames as is. For that I need a lookup file.
So, under B, a file called 1.doc is the same as myfile1.doc in A.
B/1.doc = A/myfile1.doc
The lookup file has this information in the following format:
"B:\1.doc","myfile1.doc",<some string>,<some string>
How can I do this? Part of the code is placed below but needs to be augmented for the lookup file and correct picking of filename in A.
if exist "%Target%" del "%Target%"
for %%a in ("%SourceB%\*.*") do (
echo Processing '%%~nxa' ...
if not exist "%SourceA%\%%~nxa" (
copy "%%a" "%Target%"
echo ... done.