PDA

View Full Version : BC in Automation


Decision
26-Oct-2011, 03:08 AM
Hello

I would like to use Beyond Compares functionality within Automation as there are variables defined within the project that would make a batch file highly complicated. I would like to select a large number of text files and convert them to .xml files.

I am a complete beginner to beyond compare and its scripting so if you could provide me with an example could it please be literal? i.e. a " means you need to put a " in the script.

Thanks in advance for your help

Decision

Aaron
26-Oct-2011, 09:51 AM
Hello,

Would the point of the script to be to load a single folder and rename all of the xml files within it to .txt? Or do you need to compare between two folders in some way?

What are the variables that would prevent this from being performed in the batch file?

For a BC script, it could be something like:
filter "*.xml"
load "e:\temp\rename"
expand all
select all.files
rename regexpr (.*)\.xml $1.txt


To describe the above:
filter is used first to place a filter that will show only xml files
load loads a single folder
expand all will expand any subfolders, exposing the files inside. necessary for the selection
select all files will select the xml files (since they are the only ones visible)
and the rename command uses a regular expression rename to match on the part before .xml, and rename it to .txt.

Aaron
26-Oct-2011, 09:53 AM
In addition, this script file (bcscript.txt) would be executed from the command line with:
bcompare.exe "@c:\bcscript.txt"

Please test this will a set of test folders and test data, as the rename command will not provide any feedback before executing and is not undo-able. While testing and learning script, it is always a good idea to work with a small, test subset of your data to see how it performs.