Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2004
    Posts
    2

    Unanswered: 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 10:19. Reason: forgot to mention the OS

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    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

  3. #3
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    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.
    Last edited by LKBrwn_DBA; 08-06-04 at 11:08.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  4. #4
    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?

  5. #5
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    Did you try it without the find?

    set abc [eval exec tar cvf - '.'|gzip -c >abc.tar.gz ]
    Last edited by LKBrwn_DBA; 08-07-04 at 11:44. Reason: spelling
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •