The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Create A Simple GUI For Shell Script Grizzly Shell Programming and Scripting 1 09-18-2009 11:28 AM
Shell script to create a link Shreedhar Naik Shell Programming and Scripting 3 05-22-2008 08:01 AM
shell script to create dirs sjajimi Shell Programming and Scripting 2 07-24-2007 08:34 AM
create a shell script maykap100 Shell Programming and Scripting 3 08-31-2005 11:17 PM
Shell script to create a DOS-like Menutiem bionicfysh Shell Programming and Scripting 2 06-17-2002 05:03 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-28-2009
johnycage johnycage is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 1
Create Jar using shell script

Hi Folks

I came up with peculiar requierement ..

I have to jar special files types only from a number of child folders , and also exactly same as the child file path...sorry i will give an example

suppose i have following folder structure

# cd HTML/
total 0
drwxrwxr-x 2 johycage johycage 96 Sep 23 07:42 HTML
drwxrwxr-x 2 johycage johycage 96 Sep 23 07:42 XML
-rw-rw-r-- 1 johycage johycage 0 Sep 23 07:42 1.html
-rw-rw-r-- 1 johycage johycage 0 Sep 23 07:42 2.html
#cd HTML/
total 0
-rw-rw-r-- 1 johycage johycage 0 Sep 23 07:42 1.html
-rw-rw-r-- 1 johycage johycage 0 Sep 23 07:42 2.html
# cd ../XML/
total 0
-rw-rw-r-- 1 johycage johycage 0 Sep 23 07:42 1.xml
-rw-rw-r-- 1 johycage johycage 0 Sep 23 07:42 2.xml

And all i want is to create jar file which contain onlt html file types in the following manner.

# jar -tvf test.jar
0 Wed Sep 23 07:42:22 MST 2009 home/johycage/HTML/HTML/1.html
0 Wed Sep 23 07:42:28 MST 2009 home/johycage/HTML/HTML/2.html
0 Wed Sep 23 07:42:50 MST 2009 home/johycage/HTML/1.html
0 Wed Sep 23 07:42:56 MST 2009 home/johycage/HTML/2.html

I have achieved this using below simple scriipt. But as you know adding files using jar -uvf take much time if folder strcture is more complex. I am attaching the script below which used, Anyone have a better idea ???

touch test.jar
find /home/johnycage/HTML/ -name '*.html' -print| while read obj
do
jar -uvf test.jar $obj
done

cheers
  #2 (permalink)  
Old 09-28-2009
varontron varontron is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 110
not sure if faster but try it:

Code:
find /home/johnycage/HTML/ -name "*.html" -exec jar -uvf test.jar {} \;

use '...jar -cvf... to create on the fly
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:03 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0