Solved

batch to unzip file and extract jar

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

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need to delete empty sub dirs but not include the directory itself 10 80
Recursively Delete Files 5 83
batch script 3 38
VB Script: Correction backup files and folders v3 11 25
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

777 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