tar cvf /tmp/test1.tar `perl -e 'foreach 
On 11/25/2003 12:24:26 AM, Ross Collado wrote:
> Hello,
> 
> On Solaris 8
> 
> I can't seem to get the tar command right.  I wanted to tar a directory but
> EXCLUDE one of the subdirectory in it.
> Example:
> /home/user01
> /home/user01/mark01
> /home/user01/mark01/ask.txt
> /home/user01/mark01/ghost.txt
> /home/user01/mark02
> /home/user01/mark02/ask.txt
> /home/user01/mark02/ghost.txt
> /home/user01/mark03
> /home/user01/mark03/ask.txt
> /home/user01/mark03/ghost.txt
> 
Here is how to do it:
Create script called /tmp/tmp1.pl containing the following:

#!/usr/bin/perl
open FL,"find /home -print|"||die "Cannot open file:$!\n";
$pattern="\/mark03\/";
while (<FL>) {
  chomp;
  if (/$pattern/) { next; }
  print "$_\n";
}

Purists will cringe when seeing a script without "use strict" and executing "find"
but it's short and it works.

Next, you chmod /tmp/tmp1.pl to 700 and do tar cvf /mydir/myfile.tar `/tmp/tmp1.pl`

It works each and every time.
Mladen Gogala
Oracle DBA



Note:
This message is for the named person's use only.  It may contain confidential, 
proprietary or legally privileged information.  No confidentiality or privilege is 
waived or lost by any mistransmission.  If you receive this message in error, please 
immediately delete it and all copies of it from your system, destroy any hard copies 
of it and notify the sender.  You must not, directly or indirectly, use, disclose, 
distribute, print, or copy any part of this message if you are not the intended 
recipient. Wang Trading LLC and any of its subsidiaries each reserve the right to 
monitor all e-mail communications through its networks.
Any views expressed in this message are those of the individual sender, except where 
the message states otherwise and the sender is authorized to state them to be the 
views of any such entity.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Mladen Gogala
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to