How to unzip a file on a local computer that has just been uploaded or downloaded?
If you need to extract an archive file on the local computer after a successful file transfer, you should use a post-transfer trigger.
A post-transfer trigger is executed after a successful file transfer between the remote server and the local computer and allows you to run any program, PowerShell script, or bat-file. As parameters, you can use built-in FTPGetter variables such as the %local_file% variable, which represents the full path of the transferred file on the local computer, date-related variables, and others.
Example #1: Extract the transferred archive file on the local computer.
To perform this operation, create a bat-file with the following content in any text editor.
For Windows 10/11:
SET "fullpath=%~dp2"
if not exist "%fullpath%" mkdir "%fullpath%"
tar -xf %~1 -C %~2For other versions of Windows:
SET "fullpath=%~dp2"
if not exist "%fullpath%" mkdir "%fullpath%"
powershell -Command "Expand-Archive -Path '%~1' -DestinationPath '%~2'"Save this file as my-unzip.bat in any folder of your choice.
Important note! If you are using FTPGetter in Windows service mode, make sure that the account under which the service is running has full access to this folder.
In FTPGetter, this bat-file should be called as follows:
D:\my-bats\my-unzip.bat
"%local_file%" "" 
How it works. After a successful file transfer, FTPGetter executes the my-move.bat bat-file with two parameters. The first parameter is the %local_file% variable, which contains the full path of the recently transferred file (on the local computer). The second parameter is the full path to the folder on the local computer where the archive file should be extracted.
Next, we will look at how to copy, move, or rename a recently downloaded file.
Need to unzip an archive file on the SFTP server after transfer?


