home :: features :: usage :: function :: development :: installation :: download

contact :: sourceforge

 



 USAGE
 

 

 

 

USAGE

   

Let's say the backup destination is a network device that is addressed with Z:/mime/antbackup. And we want to save the files in C:/project/sample/ and C:/project/sample/. We adapt the installed build file backup.xml accordingly:

<?xml version="1.0"?>
<project name="Backup" default="backup" basedir=".">

  <!-- set global properties for this build -->
  <property name="backupDir" value="Z:/mime/antbackup" />

  <taskdef name="archive" classname="org.qedeq.tools.ant.Archive" classpath="classes" />

  <target name="backup">
    <archive destdir="${backupDir}">
      <fileset dir="C:/project/sample/" defaultexcludes="no" />
      <fileset dir="C:/tools/" defaultexcludes="no" />
    </archive>
  </target>

</project>

Now we start the batch file backup.bat, to get our first backup. (Analogous procedure with the unix script backup.sh.) If any file to backup is still read locked, the whole backup will fail. Maybe some file in C:/project/sample/ is not readable then the backup fails, so nothing of C:/tools is saved. If you want to make independent backups you have to make several build scripts (or targets) you call independently.

To specify more than just a directory to backup but to filter the files you should take a look at ant.apache.org. E.g. if you add the following lines to the backup.xml file C:/project/sample2 is also saved, but all class files are omitted:

      <fileset dir="C:/project/sample2/" defaultexcludes="no">
        <exclude name="**/*.class"/>
      </fileset>

How is the resulting backup organized? After a successfull first backup Z:/mime/antbackup has a new directory for example 20050531T180137 and within the subdirectories sample and tools. These directories should be exact copies of the directories C:/project/sample and C:/tools. Even file timestamp and attributes should be the same - as good as Ant is able to do it with it's Copy task.

 
   
 

 

 

 
     

 top

   © 2005 by Michael Meyling •  mime@qedeq.org
 

 
features function