---
schema_version: "1"
id: 55458ea6ddcc48952181c02a0b2e12ad34b356c521e449e99b762c5b7818480b
title: "Sub-Pipeline : GetUnzipFile"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/b2c-commerce/guides/inventory/b2c-sub-pipeline-get-unzip-file.md
canonical_url: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/b2c-sub-pipeline-get-unzip-file.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7bf46798814c22cd729a86b0654f90383dabe9a1d8d1aa01f1947b4153436ca0
products:
  - Composable Storefront
  - Salesforce APIs
---
# 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://developer.salesforce.com/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](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/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](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/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.
