If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > tar & zip all the files with a <specifc name> in a directory using TCL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-06-04, 09:17
gsnaidu gsnaidu is offline
Registered User
 
Join Date: Aug 2004
Posts: 2
tar & zip all the files with a <specifc name> in a directory using TCL

I need to tar & zip all the files with a <specifc name> in a directory using TCL
in solaris environment.
I tired something like

set abc [exec find . -type f -name *.log* | xargs tar -cvf abc.tar {} \ ]
Can you share the script if anyone has dealt with this requirement?

Thanks
Sree

Last edited by gsnaidu; 08-06-04 at 09:19. Reason: forgot to mention the OS
Reply With Quote
  #2 (permalink)  
Old 08-06-04, 10:03
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool

Try something like this:
Code:
find . -name '*.log*'|xargs tar cvf - |gzip -c >abc.tar.gz
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
  #3 (permalink)  
Old 08-06-04, 10:04
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool

Try something like this:
Code:
find . -name '*.log*'|xargs tar cvf - |gzip -c >abc.tar.gz
also:
Code:
tar cvf - *.log*|gzip -c >abc.tar.gz

Ooops, sorry for the double post.
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Last edited by LKBrwn_DBA; 08-06-04 at 10:08.
Reply With Quote
  #4 (permalink)  
Old 08-07-04, 03:18
gsnaidu gsnaidu is offline
Registered User
 
Join Date: Aug 2004
Posts: 2
Thanks for the reply. I tried this in solaris environment from the shell, it works fine.

But I want execute this whole command

(tar cvf - *.log*|gzip -c >abc.tar.gz) or

(find . -name '*.log*'|xargs tar cvf - |gzip -c >abc.tar.gz)

from TCL environment, something like the following:

set abc [eval exec find . -name '.'|xargs tar cvf - |gzip -c >abc.tar.gz ]


when I execute it form TCL environemt I got "find: bad option tar"

Any idea?
Reply With Quote
  #5 (permalink)  
Old 08-07-04, 10:43
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool

Did you try it without the find?

set abc [eval exec tar cvf - '.'|gzip -c >abc.tar.gz ]
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Last edited by LKBrwn_DBA; 08-07-04 at 10:44. Reason: spelling
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On