Solved

batch to unzip file and extract jar

Posted on 2014-04-10
2
1,725 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
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 51

Accepted Solution

by:
Bill Prew earned 500 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now