| Author |
How to Extracting a *.war via "jar -xf" to another directory
|
Diego Bowen
Ranch Hand
Joined: Aug 19, 2003
Posts: 50
|
|
Hello I'm have the following: cd /home/temp/ ls diego.war(a war file called diego) diego(a directory called diego) If i do the following: jar -xf diego.war It will extract its contents into /home/temp...however I want it in /home/temp/diego. How can i extract the contents not in the current dir but one of my choosing? UNIX....I'm doing this via rpm spec file. Thanks
|
 |
Diego Bowen
Ranch Hand
Joined: Aug 19, 2003
Posts: 50
|
|
I usually answer my own questions....in any event unzipping will do the same thing and it provides an option to define alternate directories for the extraction: unzip foo.war -d /home/foo
|
 |
Carol Enderlin
drifter
Ranch Hand
Joined: Oct 10, 2000
Posts: 1340
|
|
I usually do it the other way around. cd to the directory of interest and then unjar the desired file from its location. cd /home/temp/diego jar -xf /home/temp/diego.war or jar -xf ../diego.war
|
 |
Osuwari Inu
Greenhorn
Joined: Jun 20, 2005
Posts: 13
|
|
I know this is an ancient post, but I just made a small script to recursively explode an ear/war/jar/zip and thought it might be of use to someone finding this thread.
#!/bin/sh
#
if [ ! "$1" ];
then
echo No ear file specified.
exit 1
fi
if [ ! -f "$1" ];
then
echo Specified file does not exist or is not a file.
exit 1
fi
if [ ! "$2" ];
then
echo No destination directory specified.
exit 1
fi
if [ ! -d "$2" ];
then
echo Destination directory does not exist or is not a directory.
exit 1
fi
unzip "$1" -d "$2"
find "$2" -type f -name "*.war" -exec mkdir "{}.exploded" ';'
find "$2" -type f -name "*.war" -exec "$0" '{}' "{}.exploded" ';'
find "$2" -type f -name "*.jar" -exec mkdir "{}.exploded" ';'
find "$2" -type f -name "*.jar" -exec "$0" '{}' "{}.exploded" ';'
|
Quis custodiet ipsos custodes?
|
 |
 |
|
|
subject: How to Extracting a *.war via "jar -xf" to another directory
|
|
|