Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

batch to unzip file and extract jar

Posted on 2014-04-10
2
Medium Priority
?
1,928 Views
Last Modified: 2014-04-10
folks

I have a file called "project.war"

I need a script to make a copy of this file

rename it to projectcopy.zip

extract a file called "test.jar"

and send to a folder on another server

how do I do that?
0
Comment
Question by:rutgermons
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Expert Comment

by:OrcaKnight
ID: 39991827
If you just want a batch file, it's an easy one.
You'll need to install in your path a copy of pkunzip to do it.

@echo off
xcopy project.war projectcopy.zip
pkunzip projectcopy.zip test.jar
xcopy test.jar \\servername\sharename
echo Extraction complete!
0
 
LVL 57

Accepted Solution

by:
Bill Prew earned 2000 total points
ID: 39991843
Get yourself a copy of 7ZIP from this URL, and then adjust the paths in the BAT file below and it should do what you described.

http://www.7-zip.org/

@echo off

REM Adjust path to 7Zip program as needed below
set "zip=c:\program files\7-zip\7z.exe"

REM Set source and destination folder names
set BaseDir=c:\EE\EE28409614\base
set DestDir=x:\EE\EE28409614\dest

REM Make sure the needed file exists, exit if it does not
if not exist "%BaseDir%\project.war" exit /b

REM Copy the WAR file over as a ZIP and rename
copy "%BaseDir%\project.war" "%BaseDir%\projectcopy.zip"

REM Extract the TEST.JAR file to the destination folder
"%zip%" e "%BaseDir%\projectcopy.zip" -o"%DestDir%" test.jar

Open in new window

~bp
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question