Comparing Files and Synchronizing Folders via Command Line

Command line interface in Windows is a great way to automate things. The comparison of files is not an exception. Of course we cannot automate all of the process of making the computer decide what changes are important and what are not, but what you can do is to make the process as easy as possible. 

In simple words, we want make less clicks and have the results faster.

Compare two files or folders via command line

Start Compare Suite via command line

Compare Suite supports command line interface and the easiest way to use it is to pass two files or two folder names as  parameters for the comparison. Something like this:

  • comparesuite.exe “C:\my documents\document 1.doc” “C:\my desktop\document 2.doc”

Note: we need to use quotes, otherwise Windows won’t recognize correctly passed strings.

To execute this command line you can paste this line into .bat or .cmd file.

  • Most likely, instead of comparesuite.exe you will need to specify a full path to Compare Suite (again, using quotes is a good idea).

If everything was done correctly, Windows will find comparesuite.exe, pass it the two parameters and Compare Suite will be started. The program will immediately compare files or folders passed as a parameter and will display the results.

This is the most typical way of using the command line. But sometimes we don’t want Compare Suite to start…

Silent comparison with results in the report

Sometimes we don’t need Compare Suite to start, we just need to have the resulting HTML report without opening Compare Suite’s interface. In this case we just need to add “-r” parameter:

  • comparesuite.exe “C:\my documents\document 1.doc” “C:\my desktop\document 2.doc” “-rC:\my desktop\report.htm”

Compare Suite will compare two files silently, generate a report, and save it to C:\my desktop\report.htm

  • In this way you can use Compare Suite in test scripts, like it was shown in this example.

Processing folders via command line

All features that we discussed above apply to the folder comparison as well. Moreover, with folders you can run automatic synchronization. For more details, see the next section.

Making it easy with integration manager

All these parameters might look complicated and sometimes they are. For this very reason we have “Integration manager” in Compare Suite. It will help to prepare a command line with necessary parameters.

  • Access “Integration manager” via “Integration manager” command in “File” menu.

In the Integration Manager you will be able to:

  • Specify the pair of files or folder to compare
  • Select if you want to run Compare Suite GUI or just create a comparison report
  • Specify parameters for folder synchronization

Use integration manager to create bat files

I think everything is self descriptive in this dialog. As for folder synchronization, you will need to choose the method you want to use to resolve possible conflicts and Compare Suite will do the rest of the job for you.

Integration manager saves your time

  • Folder synchronization feature might be useful for doing incremental backup of your project.

In the end, Compare Suite will show you a command line. You can try it right away by clicking “Executive” button, or you can generate a .bat file and use it for your own script.

What do users say about command line interface?

We use your product as in a command-line as in GUI mode. With these features of your product we track an unscheduled file access and improve security. Read more…

Yury Stepanov, IT Director, Itfin, Russia, Moscow

 

The PDF comparison is excellent, as well as using the GUI to run comparisons, you have the ability to use the Integration manager to build a command line, which can then be added to a batch file for full automation of the process. Read more…

Ian Falconer, Stoneridge Electronics, Dundee, Scotland. Senior team leader

 

For us, the command line interface is the key element that enables SVN integrationRead more…

Robert Bocquier, Arturia, France. Lead Software Developer

Command line interface for advanced users

There are several possibilities of using Compare Suite via command line that I want to underline:

  • Automated tests. As it was shown in another case study, Compare Suite can be used to analyze the results of tests. You can compare a log file with the current results against an old log file (that supposed to be manually checked). Compare Suite will indicate if these two files are equal or not, and if not, what the similarity score is.
  • Ignore certain lines. Compare Suite can be configured to ignore certain lines. When you use command line interface you don’t need to pass these lines as a parameter, as Compare Suite will still use its settings that you can configure via graphical interface. It also applies to other parameter. Read more about line ignoring…
  • 3-rd party compare tool. Compare Suite can be used as a 3rd party compare tool with any document management or version control software. Normally, authors of document management software are allowed to configure what 3rd part tool you want to use. And instead of absolute values (like C:\my documents\file 1.doc) you will use some parameters like %File 1% and %File 2%. When you choose to compare two files, the document management system will replace these parameters with specific file names.

An example of integration with ColumbiaSoft Document Locator

Compare Suite and ColumbiaSoft Document Locator Step-by-step guide.

Step 1. Navigate to Repository Configuration and launch Extension Manager.

Navigate to repository configuration_launch extension manager

Step 2. Highlight an existing extension. Fill in the information for the differencing tool’s executable file path.

Path to compare tool

Step 3. Select any file in Document Locator database. Right click and select “Show Differences…” in context menu of this file.

Select show differences

Step 4. Go to “Comparison Tool” page and make sure that Compare Suite is a Comparison Tool used by default.

Check compare tool

Step 5. Specify the name of file to compare with. Then click OK.

Specify two files to compare

Compare Suite displays the file differences.

Results in Compare Sute

We are interested in learning your experience about using command line interface. Feel free to share your story in the comments.


Leave a Reply

Compare Suite Video Introduction
Download free 30-day trial version.

Where Compare Suite is used:

Compare Suite Features:

Compare FileCompare documents to find differences regardless of the format: MS Word, MS Excel, MS PowerPoint, PDF.

Compare FoldersCompare two local or remote folders to find and synchronize any changes made.

Compare by KeywordsUse the keywords comparison to analyze non-related documents created from different formats.

Compare ArchiveArchive comparison: compare Rar and Zip archive files without unpacking / unzipping.

COmpare Web-PageCompare web pages as code with HTML tags or as text as seen in a web browser.

Compare ImagesCompare two images of various formats to find all possible differences, even slight ones.

Compare MultimediaMultimedia comparison. Compare information from multimedia and graphic formats.

Ignore WordsIgnore words. Compare Suite can ignore certain keywords or strings during comparison.

Integrate with DMSDMS Integration. Easily integrate Compare Suite into 3rd party document management systems.

Highlight SyntaxSyntax highlighting for .pas, .asm., cpp, PHP, XML, bat, css, dpk, xsl files supported.

Compare FTPCompare files located on FTP as easily as on hard drives or local area networks.

Compare Command LineUse command line to automate comparisons and integrate it with 3rd party tools.

Compare UnicodeUNICODE is fully supported: open and compare documents in any language or encoding.


Review compared documents:

Compare ReportCreate a fully customizable comparison report on two files or folders.

Compare CommentsWrite your own comments on changes you or your colleagues make, improving collaboration.

Audit DocumentUse document audit to accept or decline changes made in plain text files.

What is Compare Suite?

  • It is a file compare tool
  • In office Compare Suite helps to compare word files, Excel spreadsheets, web-pages
  • Software developers and web-masters use Compare Suite to do version compare, approve changes in documents or compare certain file types like XML, PHP, C-Sharp
  • Office managers use Compare Suite to diff PDF files, compare invoice files
  • Compare Suite also make it much easier synchronization of directories