View Full Version : Comparing files with variable names
Blane
07-Jul-2009, 04:29 PM
I'm trying to automate the process of comparing a base directory of text files(text reports) to newly generated text files with variable names(prefix should be the same) Example:
File list of first directory:
101-20090706.txt
102-20090706.txt
103-20090706.txt
File list of second directory: (second directory has variable contents based on date)
101-20090710.txt
102-20090710.txt
103-20090710.txt
The files from each directory should be exactly the same except for some date information in the file name and header. Is it possible to create a BC script that will compare the two directory's, matching 101-20090706.txt to 101-20090710.txt and so forth? And generate a report giving the files that are different, ignoring specific grammar rules in the header for date information.
Thank you very much for your help.
Aaron
08-Jul-2009, 09:24 AM
Hello Blane,
This is another example where you will want to setup a graphical session and configure the session settings. Once configured, loading the session in script should then work for your automation.
The feature you are looking for is called Alignment Overrides and is available in BC3 Pro. Open your Folder Compare session, go to the Session Settings, Misc tab. Add a New alignment override:
Left: "*-20090706.txt"
Right: "*-20090710.txt"
This should then align your files as you expect. Let us know if you have any questions.
ganeshjr
11-Jan-2010, 12:17 PM
Hi Aaron,
I was using the Alignment overrides feature in my session to compare files with different names.
I am trying not to use session but automate the entire process(load, filter, alignment override, sync) using script. Is there a way to use the Alignment Overrides feature in scripting rather than using the GUI session.
Thanks for the help.
-Ganesh
Chris
11-Jan-2010, 04:48 PM
Hello Ganesh,
Sorry, it isn't possible to specify alignment overrides from a script in the current BC 3.1.9. Specifying alignment overrides from a script is on our wish list.
In the current version you'll have to specify the alignment overrides interactively and save the session, then load the session in your script.
Michael Bulgrien
12-Jan-2010, 06:39 AM
If you are really adventurous, you can create a single session with an alignment override as a "template", then write a Windows script (vbScript or cScript) to edit your BCSessions.xml file and update the Alignment Override programatically before opening the session in your BC script:
<TDirCompareSession Value="Aligned_Folder_Compare">
<LastModified Value="2010-01-10 08:30:00"/>
<Rules>
<AlignWiths>
<_0>
<FindText Value="*-20090706.txt"/>
<ReplaceText Value="*-20090710.txt"/>
</_0>
</AlignWiths>
<AutoBuild Value="False"/>
<ContentCompareKind Value="ccBinary"/>
<IgnoreDST Value="True"/>
<IgnoreTimeZone Value="True"/>
<TimestampTolerance Value="0"/>
<UseContentComparison Value="True"/>
</Rules>
vBulletin® v3.7.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.