# Sub-Pipeline : GetUnzipFile

Review the GetUnzipFile sub-pipeline when scheduling inventory imports.

![GetUnzipFile sub-pipeline diagram showing steps to unzip and rename inventory import files](https://a.sfdcstatic.com/developer-website/sfdocs/commerce-cloud/media/b2c-commerce/b2c_inventory_inventory_get_unzip_file.gif)

1. Script (bc_api). Call Get `Unzip.ds` . This script unzips a file.

| Variable                 | Type         | Comment                                                        |
| ------------------------ | ------------ | -------------------------------------------------------------- |
| `@input ZIPFileName`     | `String`     | The file name of the .zip file                                 |
| `@input SourceDirectory` | `dw.io.File` | The processing directory where the file is located             |
| `@input importLogger`    | `Object`     | import logger                                                  |
| `@output UnzipDirectory` | `dw.io.File` | The unzip directory where the extracted import file is located |
| `@output ZIPFile`        | `dw.io.File` | The .zip file                                                  |
| `@output importLogger`   | `Object`     | import logger                                                  |
| `@output importError`    | `Object`     | import error                                                   |

1. Script (bc_api). Calls `[GetFilesFromDirectory.ds](b2c-get-files-from-directory-ds.md)` . This script retrieves a file list from an FTP/HTTP(S) server.

   | Variable               | Type                   | Comment                                             |
   | ---------------------- | ---------------------- | --------------------------------------------------- |
   | `@input Directory`     | `dw.io.File`           | the directory to browse                             |
   | `@input SortDirection` | `String`               | 'ASCENDING' or 'DESCENDING'                         |
   | `@input NamePattern`   | `String`               | The pattern for the filenames (use ".*" to get all) |
   | `@input importLogger`  | `Object import logger` | input for import logger                             |
   | `@output FileList`     | `dw.util Collection`   | The files matching the pattern                      |
   | `@output importLogger` | `Object import logger` | debug output for import logger                      |
   | `@output importError`  | `Object import error`  | error output for import logger                      |

2. Loop : UpzipFiles\[]

3. Pipelet : Script (bc_api). Calls `[RenameFile.ds](b2c-rename-file-ds.md)` .

4. Pipelet : Eval (bc_api). Delete the original Import .zip file with `ZipFile.remove()` .

5. Pipelet: Assign (bc_api). Set the following value.

   `ImportFile = UnzipFile.name`

6. Loop to UnzipFiles\[] until all files are processed.

7. Pipelet : Eval (bc_api). Delete the original Import .zip file direcctory with `UnzipDirectory.remove()` .

8. Continue after calling node.
