Batch Unzip

Discuss RoboTask here

Batch Unzip

Postby shane » Sat Mar 24, 2018 4:12 am

I'm trying to figure out how to unzip a lot of files. I don't think the directions in the help file are quite right (it says if you leave the files to extract field blank it will extract all, in reality it extracts none). Additionally, it isn't possible to select more than one file at a time for the top line of the dialog. I want to extract all 100+ files without having to do many clicks for each one, how can I do this?
shane
 
Posts: 6
Joined: Sat Mar 24, 2018 4:07 am

Re: Batch Unzip

Postby Oleg » Sat Mar 24, 2018 8:51 am

You can unzip all ZIP files in the folder in the loop.
Look at my example below:
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1360203151
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task21"
Hide=INTEGER|0
ID=INTEGER|-745245645
LogOnAsUser=INTEGER|1
Name=STRING|"Unzip files in the loop."
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER

[Actions\Action1]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER

[Actions\Action1\Params]
createmode=STRING|"1"
date1=STRING|"20180324"
date2=STRING|"20180324"
destvar=STRING|"ZIPFILE"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"d:\zipfiles\*.zip"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_ZIP_EXTRACT"
Enabled=INTEGER|-1
Name=STRING|"Extract Files"
Params=FOLDER

[Actions\Action2\Params]
destdir=STRING|"d:\temp"
filetounzip=STRING|"{zipfile}"
overwrite=STRING|"0"
password=STRING|"2616926221249372596426221"
passwordmode=STRING|"0"
skipolderfiles=STRING|"0"
unzipfiles=STRING|"*.*"
usefoldernames=STRING|"1"

[Actions\Action3]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"


Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Oleg Yershov
Oleg
Site Admin
 
Posts: 2351
Joined: Thu Jan 01, 1970 1:00 am

Re: Batch Unzip

Postby shane » Sun Mar 25, 2018 6:30 am

I'm not sure I understand. This seems like the same thing I tried before, with the same problem (I can only select one file at a time and it only unzips that file). What am I missing?
shane
 
Posts: 6
Joined: Sat Mar 24, 2018 4:07 am

Re: Batch Unzip

Postby shane » Sun Mar 25, 2018 6:36 am

Here's the issue I'm running into. I'm not sure what to put in the text fields to get it to extract all the files instead of just the one I select (and I can only select one)

Like say I wanted to extract all the zip files in the folder C:/userfiles into the folder C:/outputfilse what would I fill in to make that work?
Attachments
Untitled.jpg
Untitled.jpg (36.06 KiB) Viewed 1279 times
shane
 
Posts: 6
Joined: Sat Mar 24, 2018 4:07 am

Re: Batch Unzip

Postby Oleg » Sun Mar 25, 2018 8:22 am

The Extract Files action can unpack only one archive at a time.
So this button allows to select only one file.

If you need to unpack many files you have to do this in the loop: file-by-file

Like say I wanted to extract all the zip files in the folder C:/userfiles into the folder C:/outputfilse what would I fill in to make that work?

look at my example above. It unpacks all ZIP files from the folder d:\zipfiles to folder d:\temp
Import this task into RoboTask and change parameters to your own
Oleg Yershov
Oleg
Site Admin
 
Posts: 2351
Joined: Thu Jan 01, 1970 1:00 am

Re: Batch Unzip

Postby shane » Mon Mar 26, 2018 4:10 am

Aha! Now I understand the approach. I didn't need to change that field at all

However, this lead me to a different problem. Executing the script gives me a cryptic error:

[time] An error occurred. Step #1 (Extract Files).

What could be causing that? I checked that I had valid input/output folders selected, and double checked using the dialog box to select the right ones
shane
 
Posts: 6
Joined: Sat Mar 24, 2018 4:07 am

Re: Batch Unzip

Postby shane » Mon Mar 26, 2018 4:18 am

I did use a (MS) Notepad to save the text as .txt for importation, could that be the issue?
shane
 
Posts: 6
Joined: Sat Mar 24, 2018 4:07 am

Re: Batch Unzip

Postby shane » Mon Mar 26, 2018 4:34 am

There was another thing. The text as loaded had two unknown tasks. I assumed they were superfluous and deleted them, which was how I got the error I just described. But if they're meant to be usable tasks that's where the issue is
shane
 
Posts: 6
Joined: Sat Mar 24, 2018 4:07 am

Re: Batch Unzip

Postby Oleg » Mon Mar 26, 2018 12:01 pm

It seems you are using RoboTask Lite. Lite version doesn't support loops.
Probably we need to add possibility to unzip files by file mask, or files by specified list
I wrote this into our ToDo.
Oleg Yershov
Oleg
Site Admin
 
Posts: 2351
Joined: Thu Jan 01, 1970 1:00 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 13 guests