Skip to main content
Shine BR
Known Participant
November 11, 2017
Answered

Unzip a file

  • November 11, 2017
  • 1 reply
  • 7502 views

Hi Team,

Is there any possibility of unzipping a file from desktop and execute an action through PS.

Correct answer Davide_Barranca12040269

If you're familiar with command-line zip (see Unzipping Files Using Terminal | Mac Tricks And Tips for info), you can write the needed lines into a string and then pass it to the app.system() function, for instance:

var cmd = "cd ~/Desktop/srcFolder\n" +

          "unzip -o test.zip -d ~/Desktop/destFolder";

app.system(cmd);

Hope this helps,

Davide

1 reply

Davide_Barranca12040269
Community Expert
Community Expert
November 12, 2017

If you're familiar with command-line zip (see Unzipping Files Using Terminal | Mac Tricks And Tips for info), you can write the needed lines into a string and then pass it to the app.system() function, for instance:

var cmd = "cd ~/Desktop/srcFolder\n" +

          "unzip -o test.zip -d ~/Desktop/destFolder";

app.system(cmd);

Hope this helps,

Davide

Davide Barranca - PS developer and authorwww.ps-scripting.com
Shine BR
Shine BRAuthor
Known Participant
November 13, 2017

Thanks Davide!