My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Wiki pages
Links

Make Directory Difference (MakeDirDiff) tool

Русский: Описание проекта MakeDirDiff

Introduction

MakeDirDiff is a simple command line tool for finding differences between two directories and storing all new/updates files in a new directory.

MakeDirDiff compares two directories and creates the third directory with the first directory structure, but with new or updated files only. It can update the second directory content with the current content of the first directory. On the next run MakeDirDiff will find and place only new/changed files appeared in the first directory into the third directory

Look at the MakeDirDiff.gif picture to get a visual notion about MakeDirDiff data flow.

It's an Apache Ant task.

I found this extremely useful for creating incremental backups and updating big web-sites.

How it can be run

It is a simple java application, designed as an Apache Ant task.

MakeDirDiff can be

System Requirements

Troubleshooting

Executing a sample ANT task

We will run and analyze the sample ant task that is stored in build.xml file in each makeDirDiff-bin-1.x.zip file.

  1. Download makeDirDiff-bin-1.x.zip file from the Project Download page.
  2. Extract this archive to a directory.
  3. If you wish more details, look into 'build.xml' file to get some information about a way the example Ant task is defined there, otherwise skip this step.
  4. Go to this directory and run an 'ant' command using a system command line interface.
  5. You will see some output and words 'BUILD SUCCESSFUL' at the end. In this case the provided MakeDirDiff example works fine. This example task creates a 'result' directory and copy there all files from 'original' directory. It also stores an 'original' directory content into the 'previous' directory.
  6. Something has gone wrong when you don't see 'BUILD SUCCESSFUL' words. Look at the 'Troubleshooting' chapter here to find out what is your problem.
  7. That’s it! MakeDirDiff made a copy of new/updates files from the ‘original’ directory for you.
  8. Let’s try to make something more difficult. Please, remove the 'result' directory now and run 'ant' command again. You will see that the 'result' directory is created again, but it's empty. This is because it has only new/updated files and directories from the 'original' directory, which have not been changed.
  9. Make a small experiment then. Add some files and directories into the 'original' directory and run the 'ant' command again. The 'result' directory will contain all those new files and directories. It works!

Running as a java application

Command line parameters

MakeDirDiff requires three parameters and optional flags:

  • <original data directory>
  • <result directory>
  • <previous data directory>
optional flags. They can be located in any order in command line and mixed with parameters.
  • -cleanDestDir. Since ver 1.4 This flag makes the application to clean <result directory> at the beginning of work.

Note that MakeDirDiff without parameters or with wrong number of parameters shows this help text.

MS Windows command example

java -cp *; org.grenader.makedirdiff.MakeDirDiff ./original ./result ./previous 

You can find this command in the makeDirDiff-Example.bat in makeDirDiff-bin-1.x.zip archive

Unix command example

java -cp *: org.grenader.makedirdiff.MakeDirDiff ./original ./result ./previous 

You can find this command in the makeDirDiff-Example.sh in makeDirDiff-bin-1.x.zip archive

Example ANT task

The following Ant task is stored in build.xml file in each makeDirDiff-bin-1.x.zip file

 <!--   Basic Example of using makeDirDiff Ant task   -->
    <target name="example">
        <!--  Defind required jars-->
        <path id="taskDependencies">
            <pathelement location="./ant.jar"/>
            <pathelement location="./jsCssMin-1.0.jar"/>
            <pathelement location="./makeDirDiff-1.4.jar"/>
        </path>

        <!--  Defind makeDirDiff Ant task  -->
        <taskdef name="makeDirDiff" classname="org.grenader.makedirdiff.MakeDirDiff">
            <classpath refid="taskDependencies"/>
        </taskdef>

        <!--
        Execute the makeDirDiff task
          "./original" - original data directory. It's defined as a nested fileset item
          "./result" - result directory. It's defined as a destDir attribute
          "./previous" - previous data directory. It's defined as a prevDir attribute
          "cleanDestDir - true/false, not required. If "true" result directory will be                          
                          cleaned before copying new/changed files into it.
        -->
        <makeDirDiff
                destDir="./result"
                prevDir="./previous">
            <fileset dir="./original"/>
        </makeDirDiff>
    </target>

Look at other examples of calling MakeDirDiff from Ant

Features

License

MakeDirDiff is released under the Apache Software License. See LICENSE.txt for more details.

How to contribute

Acknowledgements

I'd like to thank Dmitry Solomadin who was so kind and smart to invent a name of the MakeDirDiff tool for me.

Links

100% Clean

Top 4 Download

X 64-bit Download

Best Vista Download

Windows 7 Download

Freeware Park Best MakeDirDiff

MakeDirDiff antivirus report at download3k.com

PocketPC Software Downloads

MakeDirDiff awards 5 stars on FreeSafeSoft.com

Compatible with Win7

Reviewers' Choice. MakeDirDiff

Powered by Google Project Hosting