Skip to main content

zip_n_purge_2

1. Description

Zip_n_Purge program takes an input_file and perform zipping, purging or translocating operation on the files or subdirectories present at the path specified in the input_file.

2. Program location

<installation_path>/zip_n_purge

3. Input

3.1 Mandatory Parameters

#ParametersDescriptionExample
1as_on_dateThe date for which the program has to run22-05-2024
2config_filePath to the file containing path of the directory on which operation is to be performedtest-bed/config.txt
3operation_timeframeZip/Purge/Translocate the files before the mentioned timeframe. Note: If the mentioned operation timeframe is with '+' as prefix, then the required timestamp is calculated as asondate + timeframe. If the mentioned operation timeframe is without '+' as prefix, then the required timestamp is calculated as asondate - timeframe.1Y, +1M, 1D
4log_file_pathPath to write logstest-bed/log.txt
5diagnostics_log_filePath to write diagnostics logstest-bed/diag_log.txt

3.2 Non Mandatory Parameters

#ParametersDescriptionDefault valueExample
1operation-typeType of operation to be performedZIPPINGZIPPING or PURGING or TRANSLOCATE
2log_levelLevel of diagnostics written to the log file.infoerror/warn/info/debug/trace/none
3is_perf_diagnostics_enabledThe flag that decides whether performance diagnostics will be written to the diagnostics log file.falsetrue or false
4exclude_daysSpecifies the days for which the operation should be excludedEmpty string.12
5operation_levelDetermines whether the operation should be applied to files or foldersFOLDER.FILE or FOLDER

3.3 Config File Format

3.3.1 ZIPPING
**Source-Path**|**Destination-Path**|**Zip-File-Name**|
test-bed/sourcedir/zip|test-bed/destdir/zipped|new_zipped

Note: for the above example,it will make a zip file in the destination directory with name as provided in config (new) along with the current date and time.
Example: new-23052024-131034.zip. (output: name-d/m/Y-H/M/S).
3.3.2 PURGING
**Source Path**
test-bed/sourcedir/purge
3.3.3 TRANSLOCATE
**Source Path**|**Destination Path**
test-bed/sourcedir/translocate|test-bed/destdir/translocated

4. Output

Output derivation logic:

  • Timestamp :
    Timestamp is calculated based on the provided operation-timeframe and as_on_date.

    If the mentioned operation timeframe is with '+' as prefix, then required timestamp is calculated as:

    Timestamp = as_on_date + operation-timeframe.

    If the mentioned operation timeframe is without '+' as prefix, then required timestamp is calculated as:

    Timestamp = as_on_date - operation-timeframe.

    This timestamp is then used as a reference point to determine whether files should be included for the operation or not based on their modification times. Files modified before this timestamp are included.

  • ZIPPING :
    For all files present in the folder mentioned in config-file, it will zip from source path to destination path only the files which meets the timestamp condition as mentioned above using the name provided in the config-file.

  • PURGING :
    For all files present in the folder mentioned in config-file, it will remove from source path only the files which meets the timestamp condition as mentioned above.
  • TRANSLOCATE :
    For all files present in the folder mentioned in config-file, it will move from source path to destination path only the files which meets the timestamp condition as mentioned above and deletes the moved file from the source directory.

    It also calculates the count and total size of files in the source directory before moving the files and after moving the files.

5. Process configuration in streamdef table:

        {
"processName": "zip_n_purge",
"processId": "1",
"processBinary": "{PROGRAMS}/IND/zip_n_purge",
"processArguments": [
"--as-on-date",
"{AsOnDate}",
"--config-file",
"{SH_RESOURCES}/IND/OPERATIONAL-FILES/CONFIG/zip_n_purge_config.txt",
"--log-file-path",
"{SH_LOGS}/IND/BALM/{ddmmyyyy}/zip_n_purge_log.txt",
"--diagnostics-log-file",
"{SH_LOGS}/IND/BALM/{ddmmyyyy}/zip_n_purge_diag_log.txt",
"--operation-timeframe",
"1Y",
],
"processDependencies": [
""
],
"processReport": "",
"processType": "TOOLS",
"infoLog": "{SH_LOGS}/IND/BALM/{ddmmyyyy}/zip_n_purge_log.txt",
"errorLog": ""
}