de.frame4j
Class Update

java.lang.Object
  extended by de.frame4j.util.App
      extended by de.frame4j.Update
All Implemented Interfaces:
AttrSettable, TextHelper.MessageComponents, UIInfo, ActionListener, EventListener, DynamicMBean

@MinDoc(copyright="Copyright  1998 - 2005, 2009  A. Weinert",
        author="Albrecht Weinert",
        version="V.55",
        lastModified="28.07.2010",
        lastModifiedBy="A. Weinert",
        usage="start as Java application (-? for help)",
        purpose="updates files and / or directories also by complex criteria")
public class Update
extends App

Update files and directories.

This application updates files for a source to a destination directory. Optionally sub-directories can be worked on recursively. Additionally it is possible to copy files to a backup-directory before they are replaced in the destination directory.

The making of non existent destination directories can be forbidden.

Also, the creating of non existent files in the destination directories can be prohibited; that would mean "update existing files only".

Fundamental rule:
A file will be copied from the source to the destination directory if not existing there or if there older than in source. For source files of length 0 deleting in source instead of copying the empty file can be chosen as option.

Attention: If source and destination directories are on different computers (as network drives e.g.) different time handling and especially asynchronous handling of daylight saving clock switches, can lead to totally surprising results (like updating thousands of files in the wrong direction). The same is true for diskettes or partitions using different file systems. Those effects may be experienced with all tools depending on file date/time — not just this one. But this features some safety / counter measures proven efficient over some years of experience in form of harder and adaptive age difference criteria.

The evaluation of age differences as update criterion may be switched off (by the -xCopy option). This makes the update to a plain copy, but featuring all the other FileService control possibilities.

Hint: To this application Update belongs (as integral part) a .properties file named Updatey.properties. It's part of the documentation.


Copyright 1998 - 2005, 2009   Albrecht Weinert

See Also:
App, DataFile, FileCriteria

Field Summary
 String back
          Backup directory.
 String dest
          Destination directory.
 boolean reverse
          Reverse roles of source and destination.

default: false

 String source
          Source directory with (optional) file specification.
 
Fields inherited from class de.frame4j.util.App
ano, appBase, appIO, appStartTime, args, bgColor, err, fullClassName, help, icon, INIT_ERROR, jmxRemoteNote, JOB_DONE_OK, log, LOG_OUT_ERROR, MAIN_THREAD_EXC, mainThread, myClass, myFrame, name, NO_PARS_ERROR, objectName, out, outMode, packName, prop, retCode, runFlag, shortClassName, title, verbose, verbosity
 
Fields inherited from interface de.frame4j.net.AttrSettable
ILLEGAL_TYPE, ILLEGAL_VALUE, NO_ATTRIBUTE, NO_KNOWN_ATTRIBUTE, NO_VALUE, OK
 
Constructor Summary
Update()
           
 
Method Summary
 int doIt()
          Working method of Update.
static void main(String[] args)
          Start method of Update .
 
Methods inherited from class de.frame4j.util.App
actionPerformed, allowNoPropertiesFile, clientOrder, condHelpLog, connect, errMeld, errMeld, errorExit, errorExit, errorExit, errorText, formMessage, formMessage, getAbout, getAboutText, getActTime, getAppLogger, getAppStartTime, getArgs, getAttribute, getAttributes, getAuthor, getCopyright, getDbLogger, getExecTimeMs, getExecTimeString, getHelp, getHelpText, getIcon, getLanguage, getLogHandler, getMBeanInfo, getMessageComponent, getMessageComponentsLength, getMyFrame, getName, getNameWithVersDate, getOutMode, getProp, getPurpose, getStartTime, getStateString, getTitle, getUsage, getVerbosity, getVerbosityString, getVersDate, getXMLinput, go, go, go, haveIcon, invoke, isDebug, isHelp, isHelpLog, isNormal, isRunFlag, isSilent, isTest, isVerbose, logVerbose, logVerbose, makeDbLogger, makeMenuBar, makeMenuBar, makeStatusTextEnd, makeStatusTextStart, messageFormat, normalExit, parsePartial, performeAction, postDeregister, postRegister, preRegister, queueAction, registerAsMBean, setAboutText, setAttribute, setAttribute, setAttribute, setAttributes, setAuthor, setBgColor, setCodePages, setCopyright, setHelp, setJmxRemoteNote, setLogOut2, setName, setOutMode, setOutMode, setPurpose, setTitle, setUsage, setVerbose, setVerbose, setVerbosity, setVerbosity, setVerbosityString, setVersDate, stop, threeLineEndMsg, toString, twoLineEndMsg, twoLineStartMsg, valueLang, valueLang, wakeMainThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

source

public String source
Source directory with (optional) file specification.

After the denotation of the source directory (example D:\weinert\java\) file denotations may follow directly. They may contain wildcards. Using * or ? means that the corresponding commend line parameter has to be put in quotes. Alternatively + can be used instead of *. (Example: D:\weinert\java\Data+.+).

Instead of a file name denotation like in the example a list of types is also possible (example: D:\weinert\java\java;class;bat;html).


dest

public String dest
Destination directory.

This is the denotation of the destination directory where to copy or update the files to.

Non existing directories (and sub-directories) will be made, if that is not explicitly forbidden.

In destination directory denotations the properties stJMT, stHM and stJMTHM (in batch files embraced in percent signs, like %stJMT%, %stHM% and %stJMTHM%) may be used as part of the names. These contain the date and time of the applications start.


reverse

public boolean reverse
Reverse roles of source and destination.

default: false

See Also:
FileService.reverse

back

public String back
Backup directory.

If not empty it is taken as a denotation of a directory (that will be made if needed and not yet existing). To this directory files will be copied, before the will be replaced or deleted in the destination directory dest.

Constructor Detail

Update

public Update()
Method Detail

main

public static void main(String[] args)
Start method of Update .

If the application did its job successfully it will end with exit code 0. An exit code > 0 means an abort due to a problem.

Parameters:
args - command line parameter
See Also:
doIt()

doIt

public int doIt()
Working method of Update.

Specified by:
doIt in class App
See Also:
Prop, App.go(String[], boolean), App.go(String[], String, boolean, CharSequence), App.mainThread