Focal Point
Delete file present inside a zip file

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5837032295

October 23, 2010, 06:46 AM
pink
Delete file present inside a zip file
Hi All,
Greetings!

For a file outside zip, i used !DEL FILEPATH\FILENAME and it worked fine.
But now my problem is - how to delete a file present inside a zip file ?


Any help appreciated!


Thanks and Regards,

WF 7611
XFOCUS/FOCUS DB
Win XP
EXL2K/HTML
October 23, 2010, 05:19 PM
Doug
Easy as 1, 2, 3...

1) Open the zip file,
2) Select file(s) to be deleted, and
3) Press the "delete" key (you may need to press the Confirm button)

I hope this helps




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
October 24, 2010, 04:56 PM
Waz
I suggest checking out the command line options for the achive program you are using.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 25, 2010, 05:27 AM
pink
Thanx for reply guys.

@Doug:- I wana delete it thru a fex(that is part of a batch job) and asking for some way(command) to delete it.


Thanks and Regards,

WF 7611
XFOCUS/FOCUS DB
Win XP
EXL2K/HTML
October 25, 2010, 08:35 AM
ABT
I am not sure what WebFocus uses to Zip, but I have the WinZip command line addon installed on our servers to Zip (it supports Password Protection and Encryption).

To delete files from zip files with this tool you'd use the -d option.

From the Help File:
quote:

Unless -d (delete files) is specified, WZZIP assumes "*.*" (i.e., all files) if you don't specify either @listfile or files. The -d action requires you to specify files explicitly.

Copyright © 2004 WinZip Computing, Inc. All rights reserved.


I think the code would looke like this:
wzzip -dfile_to_delete.txt zip_file.zip

-ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
October 25, 2010, 03:20 PM
Doug
Sorry Pink, for missing that part of your original request...
"@Doug:- I wana delete it thru a fex"

October 28, 2010, 06:36 AM
pink
Hi

I tried this but not successful:-

  
-SET &ZPATH = 'E:\delzipfiletest\ztest1.zip';
-SET &ZFILE = 'test3.txt';

WZZIP -d &ZFILE &ZPATH


it says unrecognized command..

Any other ideas ??


Thanks and Regards,

WF 7611
XFOCUS/FOCUS DB
Win XP
EXL2K/HTML
October 28, 2010, 07:21 AM
GamP
Of course it is an unrecognized command for FOCUS. You would have to precede it with ! or DOS.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
October 28, 2010, 08:01 AM
pink
sorry GamP, missed that part in above code.. regardless its still unrecognized command


Thanks and Regards,

WF 7611
XFOCUS/FOCUS DB
Win XP
EXL2K/HTML
October 28, 2010, 08:29 AM
ABT
- Do you have WinZip and the Command-Line Add-on installed on your server?

- Do you have a copy of wzzip installed (copied) to C:\Windows\System32\ (or do you have the path included before the exe name)?


FWIW, I have mine as a batch file that does the zip/encrypt/copy step. I can't recall the details, but I needed to do it this way to get around some limitation (output dir in a UNC maybe, not sure).

Here's Mine (verrrrry trimmed):

-SET &TOPATH   = '\\GATEWAY\PUBLIC\';
-SET &FROMPATH = 'C:\IBI\APPS\HELDFILES\';
-SET &NAMEBASE = THEDATA | '_' | &BEGDATE | '.' | &ENDDATE;
-SET &FILENAME = &NAMEBASE | '.TXT';
-SET &ZIPNAME  = &NAMEBASE | '.ZIP';

-SET &OUTFILE = &FROMPATH | &ZIPNAME;
-SET &INFILE  = &FROMPATH | &FILENAME;
-SET &FINFILE = &TOPATH | &ZIPNAME;

.
.
.

TABLE FILE BT_MATCH_STEP_2
PRINT
	OUT_LINE
ON TABLE HOLD AS DATAFINAL FORMAT ALPHA
END


-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-* STEP ZIP/ENCRYPT/PASSWORD
-*
-* Z I P / E N C R Y P T   F I L E
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

DOS "\\server\c$\Documents and Settings\someid\My Documents\scripts\ZIPCOPYENCRYPT.BAT" &OUTFILE &INFILE


-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-* STEP COPY OUT
-*
-* C O P Y   F I L E   T O   P U B L I C   F T P   S H A R E
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

DOS COPY &OUTFILE &FINFILE



Here's the batch file that does the zip:
"c:\program files\winzip\wzzip" -sSuPeRSeCrEtPaSsWoRd -ycAES256 %1 %2 "C:\Documents and Settings\someid\My Documents\Support_Files\project\*"

If Not ErrorLevel 1 Goto Exit
Echo *** ERROR COPYING FILE ***
:Exit



------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
October 28, 2010, 10:17 AM
GamP
Still, you do have to have WZZIP.exe available. If you don't have that executable, or if you do but try to start it without specifying the path to the exe you'll get the unrecognized command.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
November 03, 2010, 04:05 AM
pink
Thanks ABT and GamP for the insight. For the time being this has been taken care by Java in my application. But I would like to work on this as soon as I get a bit free Smiler


Thanks and Regards,

WF 7611
XFOCUS/FOCUS DB
Win XP
EXL2K/HTML
November 03, 2010, 08:10 AM
<JG>
WebFOCUS has it's own zip functionality (PK zip)

for example to zip files i.e. the standard log files from the edatemp working directory into c:\temp\xx.zip

! zip c:\temp\xx stderr.log stdout.log sysh.tmp

To delete a specific file i.e. sysh.tmp from zip file xx.zip

! ZIP -d c:\temp\xx sysh.tmp

to display standard help for the zip utility

! zip -h

to display extended help for the zip utility

! zip -h2
November 03, 2010, 08:56 AM
pink
Hi JG,
I'll try that for sure and revert early next week Smiler


Thanks and Regards,

WF 7611
XFOCUS/FOCUS DB
Win XP
EXL2K/HTML
November 03, 2010, 10:38 AM
ABT
JG,
Thanks for the tip. I used PKZIP back in the day (Windows 3.1) and its nice to know that's what's under the covers.

I assume that's only on Windows, just curious if our *nix brethren have gunzip/gzip under their covers.

- ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro