WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> Bug Reports >> unzipping gunzip
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1151505867

Message started by satisfactionsap on Jun 28th, 2006 at 4:44pm

Title: unzipping gunzip
Post by satisfactionsap on Jun 28th, 2006 at 4:44pm
Hi

Can watchdirectory unzip files with .gz extentions. (gunzip files)

Thanks

Title: Re: unzipping gunzip
Post by Gert on Jun 29th, 2006 at 5:24am
Hi,

At the moment, WD (the AutoUnzip plugin) does not directly support .gz files. However, if you use the "automatically run a .bat file" plugin, and have a commandline decompressor for .gz files, it should be easy enough to support it.
Do you have a url for a commandline gz uncompress tool, then I will create a script for you?

Gert

Title: Re: unzipping gunzip
Post by satisfactionsap on Jul 3rd, 2006 at 5:52am
hi gert

the url i have it http://www.gzip.org/ it has lots of info.
If this works ie. if the wd can automatically unzip .gz files then i want to buy the software...because i need to use it for a longer period of time...on one of my projects..

thanks

Title: Re: unzipping gunzip
Post by Gert on Jul 4th, 2006 at 12:25am
Okay,

Try the following .bat file
[code]
SET TARGETDIR=D:\Target
SET TARGETDRIVE=D:
SET GZ=E:\Bin\gzip.exe

rem create the target directory, in case it doesn't exist yet
MD "%TARGETDIR%"
rem if the gz file was found in a directory below the monitored dir create a corresponding sub-directory
IF "%WD_RELDIR%" NEQ "" (
 TARGETDIR=%TARGETDIR%\%WD_RELDIR%
     MD "%TARGETDIR%"
)

rem create a sub-directory with the same base-name as the gz file
SET TARGETDIR=%TARGETDIR%\%WD_FILE_N%
MD "%TARGETDIR%"
rem make the target drive and directory current
"%TARGETDRIVE%"
CD "%TARGETDIR%"

rem unzip the new file
"%GZ%" -d "%WD_FILE%"
[/code]

make the needed changes to the first 3 lines (where to find gzip.exe and where to uncompress the files).

Gert

Title: Re: unzipping gunzip
Post by satisfactionsap on Jul 5th, 2006 at 4:55am
Hi Gert

I am a bit confused. Do i have to make changes in the watchDirectory\plugins\wdopAutoRunBat\templates directory.
PLease explain more to me please.

cheers

Title: Re: unzipping gunzip
Post by satisfactionsap on Jul 5th, 2006 at 5:16am
Hi once again

There are 3 types of files in the "\watchDirectory\plugins\wdopAutoRunBat\templates" directory. Can you please advise me if i have to make some changes here. ALso there is a "\watchDirectory\plugins\wdopAutoUnzip" directory, is there any changes to ba made here...also when using the wizard in the "new task" which option should i choose to decompress the .gz files. Is it still:
"Automatically decompress ZIP files"? Please help me here. WHere does the code you gave me go exactly and what name should the batch file be?

Thanks

Title: Re: unzipping gunzip
Post by Gert on Jul 5th, 2006 at 9:32am
Sorry for the confusion.
You should create a file called AutoUngzip.bat (the extension IS important) using a text editor (notepad), save it anywhere you like on the local computer (not on a network). For example C:\Bin\AutoUngzip.bat.

Now create a new watchDirectory task and use the "Automatically run an existing .bat file" plugin (see http://www.watchdirectory.net/wdhelp/plugins/wdopAutoRunBat.html ), and select the C:\Bin\AutoUngzip.bat.

Does that make sense?

Gert

Title: Re: unzipping gunzip
Post by satisfactionsap on Jul 6th, 2006 at 6:55am
HI gert

sorry stupid me...i overlooked that the code you gave me has to be modified to set a target folder...it all works fine but for the main problem...wd is not able to unzpi the .gz file but just creates a folder in the targer dir but does not actually have the file in it.
its a .dat file which is gzipped. but there is not .dat file in the folder.

cheers

Title: Re: unzipping gunzip
Post by satisfactionsap on Jul 6th, 2006 at 7:33am
hi gert

after looking at the wd log file

the get the following error.


"...\gzipd\xxx.dat.gz:no such file or dir", where xxx is the file name to be uncompressed and gzipd is the folder that is trigerred.
for the dir which is being watched by wd.

i think its to do with the gunzip part of the code.

also i have downloaded a gzip.exe from the following site:
http://www.stallion.com.au/html/download/utilities.html

and the gzip.exe file is stored in c:\Bin


however when i use gzip32.exe it works but the file is unzipped and replaces the zipped file in the source dir (wd dir which is being watched) and in the target dir, only a folder is created with the same name. There is no file inside it.


thanks


Title: Re: unzipping gunzip
Post by Gert on Jul 6th, 2006 at 10:23am
Can you send me the .dat.gz file so I can experiment with it? See my signature for my email address.

Gert

WatchDirectory Forum » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2017. All Rights Reserved.