monitor a folder and unzip files

Discuss RoboTask here
Post Reply
robohobo
Posts: 3
Joined: Thu Apr 26, 2007 9:27 am
Location: United Kingdom

monitor a folder and unzip files

Post by robohobo »

Hi all, I want to monitor a folder and unzip the archive files as they come in from FTP how can this be done with this software?I tried myself but i keep getting errors.PS i'm not a natural programmer more of a graphic designer.
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

monitor a folder and unzip files

Post by Oleg »

Probably the task tries to unzip file that not has been downloaded completely yet.

Try to insert "Wait for file" action before unzipping. This action will wait until the downloading has finished.
robohobo
Posts: 3
Joined: Thu Apr 26, 2007 9:27 am
Location: United Kingdom

monitor a folder and unzip files

Post by robohobo »

Thanks for the reply, I was testing it on a downloaded file. I created a folder called 'Zipped files'  I then set robotask to monitor the folder for new files, if it found a *.zip file it should unzip it. I have since found out that this program can only deal with .zip files, thats very limiting, unfortunately people send me archive files in various forms; including .rar, .ace etc. in fact the majority of files are .rar because of better compression over .zip files. I start the task a then drop a zip file into the folder, the task runs then...This is what I get in my log:I: 27/04/2007 10:01:36: ****** Starting task... ******************I: 27/04/2007 10:01:36: Task started with priority: NormalI: 27/04/2007 10:01:36: Executing "Extract Files"I: 27/04/2007 10:01:36: Input file does not existE: 27/04/2007 10:01:36: Probably bad archive (List index out of bounds (1))E: 27/04/2007 10:01:36: An error occured. Step #0 (Extract Files).E: 27/04/2007 10:01:36: Task execution is abortedThere is nothing wrong with the file and I can unzip it. I think it doesn't like winrar; if thats the program its trying to use to unzip the file, else its windows proprietry extract utility, but that works too. I think its the logic side i'm getting wrong and i ain't into logic
Last edited by robohobo on Fri Apr 27, 2007 5:08 am, edited 1 time in total.
robohobo
Posts: 3
Joined: Thu Apr 26, 2007 9:27 am
Location: United Kingdom

monitor a folder and unzip files

Post by robohobo »

here is the task file:;**********************;* RoboTask Task file *;* Do not edit!       *;********************** [Root]ActionAfterRun=INTEGER|0Actions=FOLDERAutomat=INTEGER|-1CatID=INTEGER|1981091247ContinueOnError=INTEGER|0Events=FOLDERExternalName=STRING|"Task2"Hide=INTEGER|0ID=INTEGER|1879346195Name=STRING|"Extract Files..."Priority=INTEGER|3RunOnClose=INTEGER|0RunOnStartup=INTEGER|0ToLog=INTEGER|3[Actions]Action1=FOLDER[Actions\Action1]ActionID=STRING|"A_ZIP_EXTRACT"Enabled=INTEGER|-1Name=STRING|"Extract Files"Params=FOLDER[Actions\Action1\Params]destdir=STRING|"C:\Documents and Settings\Lee\Desktop\zip folder"filetounzip=STRING|"*.zip"overwrite=STRING|"0"password=STRING|"2488926474257142545418538"skipolderfiles=STRING|"0"unzipfiles=STRING|"*.*"usefoldernames=STRING|"0"[Events]Event1=FOLDER[Events\Event1]Enabled=INTEGER|-1EventID=STRING|"E_FILE_MONITOR"Params=FOLDER[Events\Event1\Params]chg=STRING|"0"chga=STRING|"1"chgsl=STRING|"1"chgsm=STRING|"1"chgtl=STRING|"1"chgtm=STRING|"1"del=STRING|"0"folder1=STRING|"C:\Documents and Settings\Lee\Desktop"foldercount=STRING|"1"id=STRING|"BTUOYWWF1"incmask=STRING|"*.*"interval=STRING|"60"listmode=STRING|"1"mon_files=STRING|"1"mon_folders=STRING|"0"new=STRING|"1"saveresults=STRING|"0"subfolders1=STRING|"1"
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

monitor a folder and unzip files

Post by Oleg »

For more compatibility you can use external utility, such as WinRAR. It supports command line parameters and most popular formats of packed files.

See "Run program/Open document" action.
Aster
Posts: 4
Joined: Sat Sep 06, 2008 9:26 am

monitor a folder and unzip files

Post by Aster »

I'm having the same confusion.  I want to simply have Robotask monitor a folder and, if it finds a .zip file, unzip it.So, for instance I have a .zip file in a folder called "Test" on my desktop.  I have tried using the Extract files action, with the "File to Unzip" pointing toC:\Documents and Settings\R\Desktop\Test\*.zipand the destination folder set toC:\Documents and Settings\R\Desktop\Test\and the "files to unzip" set to*.*However, when I run the task, it gives me:I: 9/7/2008 1:43:32 PM: Executing "Extract Files"I: 9/7/2008 1:43:32 PM: Input file does not existE: 9/7/2008 1:43:32 PM: Probably bad archive (List index out of bounds (1))E: 9/7/2008 1:43:32 PM: An error occured. Step #0 (Extract Files).Am I setting the task up wrong?
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

monitor a folder and unzip files

Post by Oleg »

In order to unpack file you have to use the file name (not the mask)

If you want to unpack many files, or you don't know the filename beforehand you may use file loop

File Loop // by *.zip files
   Extract Files //from current file
End Loop
Aster
Posts: 4
Joined: Sat Sep 06, 2008 9:26 am

monitor a folder and unzip files

Post by Aster »

Got it, thanks Oleg!It took a bit of headscratching because I don't know much more than the basic logic behind coding, but I figured it out.  To help anyone who comes by wondering how to do this (like me!), I'll give the elaboration on Oleg's suggestion:First action:File Loop --Parameters:  ---Loop Kind: by files only---Search in: whatever directory you want to monitor, and use a wildcard so it looks for zip files (for me:  C:\Documents and Settings\R\Desktop\Test\*.zip)---Assign Current Filename to Variable: UNZIPMESecond action: Extract Files--Parameters:  ---File to Unzip:  {UNZIPME}---Destination Folder:  wherever you want the files unzipped to.---Files to Unzip:  *.*Third action:  End LoopFourth action:  Remove variable "UNZIPME"
WouterVK
Posts: 1
Joined: Fri Jun 18, 2010 2:04 am

monitor a folder and unzip files

Post by WouterVK »

Hey Aster,
 
when I use your actions, robotask just unpacks ONE file. No errors, but the other files stay unzipped. :(
Aster
Posts: 4
Joined: Sat Sep 06, 2008 9:26 am

monitor a folder and unzip files

Post by Aster »

I forget whether I tried more than one file when I was
testing this. Usually I only get a .zip in a blue moon,
so maybe I didn't catch that one.

Some thoughts, though: if you specifically run the
program on the folder again, does it then find another
.zip file in the folder and unpack that one? Maybe it's
only running one pass of the commands and not searching
again after it's finished? Perhaps an action needs to be
put onto the end to run it again if there are still files
in the folder or somesuch. Something akin to the If/then
loop set up here?

Unfortunately, since then I've switched computers and
lost the full Robotask, so I don't have all the options
anymore (like file loop). :( So you'll be on your own
for actual testing...
Post Reply