Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Shell Script to Extract Password Protected Zip File

  1. #1
    Join Date
    Oct 2017

    Default Shell Script to Extract Password Protected Zip File

    I need to unzip password protected files. Pentaho's current "unzip" job doesn't have password functionality, so I downloaded 7z and wrote batch script to extract instead.

    My goal is to setup a job that grabs all file names from a certain folder and passes them through as arguments to the shell job & corresponding batch script. The batch script looks like such:

    7z e %1 -P password

    The current job is setup to 1) Start --> 2) Add filenames to result --> 3) Shell job.

    Within #3, I have checked "copy previous results to args", but do not know how to reference the filenames/args from the "Add filenames to result" step to then pass into the %1 variable within the batch script.

    I've searched throughout forums but could not figure this out. Apologies if I missed something that covers this - any guidance would be greatly appreciated.

  2. #2
    Join Date
    Jun 2012


    You may have missed the fact that "result rows" and "result filenames" are not the same thing: One is a list of filenames, the other carries data rows.
    Option "copy previous results to args" is tied to "result rows" which must be provided by a transformation via step "Copy-Rows-To-Result".

    Why don't you just enhance the script like:

    set /p @PASSWORD=<%USERPROFILE%\.auth\zip-password.txt
    forfiles /P "path\to\zipfiles" /M "*.zip" /C "cmd /c 7z e @path -P %@PASSWORD%"
    So long, and thanks for all the fish.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.