cancel
Showing results for 
Search instead for 
Did you mean: 

File to File scenario : Unzip a File using OS command

former_member190358
Participant
0 Kudos

Hello everyone,

Its a file to file scenario where user is sending ZIP files .

I need to UNZIP it using OS command. Its a SAP 7.11 version with SP 05.

Can anyone suggest  how can we unzip the contents using OS command.

Regards,
Ravi

Accepted Solutions (1)

Accepted Solutions (1)

javier_alcubilla
Contributor
0 Kudos

Hi Ravi

First you have to provide your operating system.

Under windows you can use 7zip software and extract the files easily, under unix you can use a shell script or commands like unzip, gzip....

And you can use the adapter module PayloadZipBean mentioned above.

Regards

Javi

former_member190358
Participant
0 Kudos

Hello Javier,

The PayloadZipBean does not work in my scenario as the zip file has more than one file.

And at the receiver side, there is only one file getting downloaded if i use the zip bean  in sender channel .

However, could you help me with some inputs on OS command.

Regards,

Ravi.

javier_alcubilla
Contributor
0 Kudos

Hi Ravi

PayloadZipBean unzip n files but the receiver file adapter only can write one file.

Which is your OS?

Maybe you can write an adapter module to unzip the desired files

Adapters and Adapter Modules for SAP NW PI 7.1

http://scn.sap.com/docs/DOC-3795

How To... Create Modules for the JEE Adapter Engine

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c0b39e65-981e-2b10-1c9c-fc3f8e674...

Regards

Javi

Answers (4)

Answers (4)

praveen_sutra
Active Contributor
0 Kudos

hi Ravi,

If its a windows server: Copy the below code to a batch file and execute. Below requires Winzip to be installed/accessible from your machine. Do change variables as per your need.

you can call the batch file frm your command line argument.

@ECHO OFF
SET winzip_path="C:\Program Files\WinZip"
SET source_path="C:\Test"
SET output_path="C:\Output\"
SET log_file="C:\Test\unzip_log.txt"
SET file_name="*.zip"

cd %source_path%
echo Executing for %source_path% > %log_file%

FOR /f "tokens=*" %%G IN ('dir %file_name% /b') DO (
echo Processing : %%G
echo File_Name : %%G >> %log_file%
%winzip_path%\WINZIP32.EXE -e %%G %output_path%
)

PAUSE

thanks and regards,

Praveen T

Former Member
0 Kudos

Just to complete the list: if you're trying to use zip in a mobile application then please have a look at:

http://jsxgraph.uni-bayreuth.de/wp/2009/09/29/jsxcompressor-zlib-compressed-javascript-code/

Bhargavakrishna
Active Contributor
0 Kudos

Hi,

Refer the below links for the same

http://scn.sap.com/message/13923250

http://saptechnical.com/Tutorials/XI/ZippingFiles/demo.htm

http://scn.sap.com/thread/962966

For Script refer Ninad sane reply in this thread for OS script.

http://scn.sap.com/thread/1845624

Regards

Bhargava krishna

former_member208404
Participant
0 Kudos

Hi Ravi,

There is a adapter module available for the zip and unzip functionality. Check this link below

http://help.sap.com/saphelp_nw73/helpdata/en/45/da9358a1772e97e10000000a155369/content.htm

Hope this helps!

Abhishek

former_member190358
Participant
0 Kudos

Hello Abhisek,

I have already checked it but it does not work in my scenario as the zip file has more than one file.

And at the receiver side, there is only one file getting downloaded.

How can i Unzip all the 15 files from the folder.

Ravi