PowerShell to compare files in folder B to a lookup for new names and then new name to files in folder A
Posted on 2014-03-20
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 PowerShell 2.0. 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:
"Z:\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.