Dependency perl program

Compress file

The compress file lists all the types of files that want to be compressed, where type is the files that have the same filename except for a change of date. A compress file will looks like

#===========================================                  
# Here all the types of files that require compressing 
# are listed.
#===========================================
# Compress all the raw data
#-------------------------------------------
$dataDir$/raw_%measVar%YEAR-MONTH-MDAY.dat;

where $dataDir$ and %measVar% will be defined in the dependency file, which is read by the DPP before this. Only the files whose children have all been created and are up-to-date will be compressed.

When a compressed and uncompressed version exist

Sometimes the same file can exist in both compressed and uncompressed form. In this case, a decision needs to be made as to which is the version that should be kept. The DPP carries out the following:

  1. rename the uncompressed version of the file, (let filename be the file name), to have the extension _tmp (filename_tmp).
  2. uncompress the compressed version, so filename.gz becomes filename (although bzip2 instead of gzip, or another compression could be used).
  3. Compare the size and age of the two files, filename and filename_tmp.
    • If one file is smaller than the other, delete it. (This should remove any partial files.) If the filename_tmp is left, rename to filename.
    • Otherwise, if one file is older than the other, delete it. (Assuming that newer files are more likely to be the better version). If the filename_tmp is left, rename to filename.
    • If both files have the same size and age, delete filename_tmp

Things to do now

Contact

Page navigation