[Files] Compress
This module compresses one or more files, either to a specified destination folder, or in-place. In regular usage, the files are compressed as they are copied or moved to their destination with each file that is being compressed having the same root filename as the original source file. Except the file extension is changed to denote the file as being compressed. Thus, a file that came from the source list of files with the filename "Chain Quarterly Inventory Results 2012.xlsx" will become "Chain Quarterly Inventory Results 2012.xlsx.zip". Each compressed file in the destination has the same base source filename as the original file did.
Additionally there is an optional grouping set of options which changes the behaviour of the specified destination. When the grouping options are used, the destination filename may not be a 1:1 relationship to the source files. The destination file may contain multiple files from the source based on the selected grouping options. The grouping option allows the source files to be compressed together into a single .zip file on each execution. The grouping options are based on a time period setting which controls how the destination filename is generated. This option is combined with the file prefix option and the date/time the module is executed to determine the actual name of the destination file.
The table below illustrates how the combinations can be used together when the input files are these three files:
- Daily Sales 1.xlsx
- Daily Sales 2.xlsx
- Daily Sales 3.xlsx
For illustrative purposes below we are assuming the module executed on 2012-02-03 at exactly 23:00:00, and this is reflected in the date and time based values in the destination filenames for all options except the None option:
| Grouping | File Prefix | Destination Filename(s) |
|---|---|---|
None |
(none) Hello |
Daily Sales 1.xlsx.zip Daily Sales 2.xlsx.zip Daily Sales 3.xlsx.zip Hello_Daily Sales 1.xlsx.zip Hello_Daily Sales 2.xlsx.zip Hello_Daily Sales 3.xlsx.zip |
Timestamp |
(none) Hello |
2012-02-03_23-00-00.zip Hello_2012-02-03_23-00-00.zip |
Hour |
(none) Hello |
2012-02-03_23.zip Hello_2012-02-03_23.zip |
Day |
(none) Hello |
2012-02-03.zip Hello_2012-02-03.zip |
Week |
(none) Hello |
2012-02-W05.zip Hello_2012-02-W05.zip |
Month |
(none) Hello |
2012-02.zip Hello_2012-02.zip |
Quarter |
(none) Hello |
2012-Q1.zip Hello_2012-Q1.zip |
Year |
(none) Hello |
2012.zip Hello_2012.zip |
As we can see from the examples in the list, when no grouping option is selected, the files will keep their original base filename. A file prefix can be specified for the None option and doing that will add the prefix to the original filenames. That option may not seem so useful for the None option, but that changes when combined with any of the other grouping options.
Except for the None option, when the destination filename is based on the selected grouping option, the generated filename for the destination is likely to use the same destination filenames when the module is executed multiple times within the time period that corresponds to the named grouping option. Or in other words, if you selected the Month option for grouping, every time you execute the module within the same month, it will use the same destination filename. This is beneficial in that new input files on the subsequent executions will be continually added to the compressed file. So, in the scenario using the Month option, all files for the same month will be added to the destination compressed file for that entire month.
Again, keep in mind that all the grouping options besides None, and the values for determining the output filenames, are based on the date and time of the module being executed. It is not based on the source files filenames. This behavior only has a superficial appearance as being different when grouping is not used, when the original source files have dates and/or times in their filenames.
The parameters that the module uses are detailed in the following table.
| Parameter | I/O | Description |
|---|---|---|
| FileSource | In | This is a list of paths to existing files for the module to process. There should be one or more entries for the module to process. |
| Action | In | Copy: Copies the source files to the destination. Move: Copies the source files to the destination and then deletes from the source folder the files that were copied. |
| DestinationFolder | In | This should be a full path to the folder where you want your compressed output files to be written to. A path can be specified as a local path, or as a UNC path. Examples: D:\Sales\DailyDetailArchive \ServerName\ShareName\Sales\DailyDetailArchive |
| CompressionGrouping | In | None: Creates one destination zip file for each source file, with the same name as the source file, plus a ".zip" extension. Timestamp: Compresses all files to a single file named Hour: Compresses all files to a single file named Day: Compresses all files to a single file named Week: Compresses all files to a single file named Month: Compresses all files to a single file named Quarter: Compresses all files to a single file named Year: Compresses all files to a single file named See the table in the section above for more details. |
| FilePrefix | In | This string, plus an underscore ("_") character is added to the start of the destination filename when specified. Applies to all CompressionGrouping settings above. |
| LogOutputLevel | In | Minimal: Normal output to the log. Verbose: More detailed output is written to the log, suitable for debugging purposes. |
| FileList | Out | On a successful outcome, this will be a list of the files written to the compressed file(s). |