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
# | Parameters | Description | Example |
---|---|---|---|
1 | as_on_date | The date for which the program has to run | 22-05-2024 |
2 | config_file | Path to the file containing path of the directory on which operation is to be performed | test-bed/config.txt |
3 | operation_timeframe | Zip/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 |
4 | log_file_path | Path to write logs | test-bed/log.txt |
5 | diagnostics_log_file | Path to write diagnostics logs | test-bed/diag_log.txt |
3.2 Non Mandatory Parameters
# | Parameters | Description | Default value | Example |
---|---|---|---|---|
1 | operation-type | Type of operation to be performed | ZIPPING | ZIPPING or PURGING or TRANSLOCATE |
2 | log_level | Level of diagnostics written to the log file. | info | error/warn/info/debug/trace/none |
3 | is_perf_diagnostics_enabled | The flag that decides whether performance diagnostics will be written to the diagnostics log file. | false | true or false |
4 | exclude_days | Specifies the days for which the operation should be excluded | Empty string. | 12 |
5 | operation_level | Determines whether the operation should be applied to files or folders | FOLDER. | 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": ""
}