Sponsored Content
Full Discussion: GNUTAR exclude directories
Top Forums UNIX for Advanced & Expert Users GNUTAR exclude directories Post 35560 by Perderabo on Thursday 17th of April 2003 11:44:19 AM
Old 04-17-2003
We seem to have several problems here....

xargs collects as many arguments as will fit on a line and then invokes the given program. A find command might find 1000's of files. So rather than, say, doing an "rm" 1000's of times, it better to use xargs. Then you may only use a few dozen rm commands, each one having a full argument list.

But this doesn't extend to "tar cvf /some/file". If you have too many arguments for one command line, you will get two command lines. The second "tar cvf /some/file" will overwrite the contents of the first. If you are not encountering this problem, you must not have very many files.

Next, when you ask tar to backup a directory, it will backup the contents of the directory as well.
So:
tar cvf /tmp/data.tar /appl/data /appl/data/somefile
is not going to backup one directory and one file. That "/appl/data" will cause tar to pick up the whole thing. The /appl/data/somefile will put a second copy of somefile in the archive. Your find command will output /appl/data as its first line. That already gets you everything.

And none of this has anything at all to do with exclude files which is where the thread started.

What you're supposed to do is to create a file and put the stuff in it that you want to exclude. So, for example, edit the file /tmp/ExcludeFile and put in the following two lines:
/appl/data/temp1
/appl/data/temp2
Then use the command:
tar cvfX /tmp/datadir.tar /tmp/ExcludeFile /appl/data
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

find command to exclude directories

Howdy I have this directory structure ... eep eepaptest eepfatest eepgltest eep.old eeppoptest ehf ehfaptest ehfgltest ehp ehpgltest I want to find files in these directories, but I want to exclude eep, ehf & ehp. Cany anyone help with the correct command ?? (1 Reply)
Discussion started by: SmurfGGM
1 Replies

2. Shell Programming and Scripting

Find but exclude directories

Hello, I have a line in my script to find the files changed in the last 24 hours. It is as below: find /home/hary -type f -mtime -1 I now want to exclude a directory named "/home/hary/temp/cache" from the above find command. How do I add it to my script? Any help is appreciated. ... (9 Replies)
Discussion started by: tadi18
9 Replies

3. UNIX for Dummies Questions & Answers

How to Exclude multiple directories from find command?

Hi, Can some one help me how to exclude multiple directories using find command.. I have the directory structure below. /a/a1/b1 /a/c1/c2 /a/d1/d2/d3 I want to exlcude a1,c2and d3 from the above using find,can some one suggest pls.. thanks in advance... Use code tags... (1 Reply)
Discussion started by: jagadish_gaddam
1 Replies

4. Shell Programming and Scripting

Help - Find command to exclude sub-directories

Hi Forum. I'm trying to write a script that finds and deletes files that are older than 300 days. The script will read a table that contains the following 3 columns: 1st col: “Y” means sub-directory scan; "N" means no subdirectory scan 2nd col: sub-directory location 3rd col: File prefix... (7 Replies)
Discussion started by: pchang
7 Replies

5. Shell Programming and Scripting

How to exclude the empty directories

Hi., I have a script, in which I am processing a files present in the directory types. ls -lrt | grep ^d | grep Dir_type | awk -f '{print $9}' |\ while read dir_name; do #operations done where Dir_type is the pattern in which directories get created. How to filter out empty... (2 Replies)
Discussion started by: IND123
2 Replies

6. Shell Programming and Scripting

Perl exclude directories in command line

Hi, I use find command to list all the files in a directory and its sub-directories, but the problem is to exclude certain directories during search. Can i give the directory names in command line to skip them and search rest of the directories? For example i have directories: test ../test1... (1 Reply)
Discussion started by: nmattam
1 Replies

7. Shell Programming and Scripting

Global Pattern - exclude directories

All, I am trying delete folder by adding pattern not to delete certain folders. But i struck with error. When i use below command from command line, it works fine. shopt -s extglob rm -rf !(test1|test2|test3) But when i use the same in shell script, i get the below error. syntax... (6 Replies)
Discussion started by: vino_hymi
6 Replies

8. AIX

Exclude Directories in my tar command

Hi, im having some issues after i execute the next command: tar -cvf /varios/restore/test.tar -X /jfma/test1/excludefile /jfma | gzip -c > /varios/restore/test.tar.gz this creates the desired "test.tar.gz" file, but whe i try to open it it says "tar: 0511-164 There is a media read or write... (6 Replies)
Discussion started by: blacksteel1988
6 Replies

9. Shell Programming and Scripting

Exclude directories in FIND command

Can you please help tweak the below command to exclude all directories with the name "logs" and "tmp" find . -type f \( ! -name "*.tar*" ! -name "*.bkp*" \) -exec /usr/xpg4/bin/grep -i "user_1" /dev/null {} + >result.out bash-3.2$ uname -a SunOS mymac 5.10 Generic_150400-26 sun4v sparc sun4v... (9 Replies)
Discussion started by: mohtashims
9 Replies
ndmp(4) 							   File Formats 							   ndmp(4)

NAME
ndmp - configuration properties for Solaris Network Data Management Protocol (NDMP) server DESCRIPTION
The behavior of the Solaris NDMP server is specified by property values that are stored in the Service Management Facility, smf(5). An authorized user can use the ndmpadm(1M) command to set global values for these properties in SMF. You can set the following properties by using the ndmpadm set command: backup-quarantine Backup the files marked as quarantined by AV. Acceptable values are yes or no. The default is no. dar-support Set the Direct Access Recovery mode. Acceptable values are yes or no. The default is no. debug-level Set the debug level. The debug-level can be set to either 0 (off) or 1 (on). The default is 0. debug-path The path to which to save the debug log. The default is /var/ndmp. dump-pathnode Enable or disable backing up the directories containing modified files or directories in dump(1) backup format. Acceptable values are yes or no. The default is no. ignore-ctime Determines whether the change timestamp (ctime) of files and directories is used to determine whether a file should be backed up in level backup. If this parameter is set to yes, only the modification time (mtime) of the file or directory determines whether it should be backed up. Acceptable values are yes or no. The default value is no. overwrite-quarantine Restore quarantined files on top of current files if they already exist. Acceptable values are yes or no. The default value is no. restore-quarantine Restore the files that had been marked as quarantined by AV and are backed up. Acceptable values are yes or no. The default value is no. tar-pathnode Enable or disable backing up the directories containing modified files or directories in tar(1) backup format. Acceptable values are yes or no. The default value is no. token-maxseq Set the maximum sequence number for subsequent token-based incremental backup in NDMP-V4. The default value is 9. There are two limits for this value: soft-limit, which is 59, and hard-limit, equal to 64. If the token sequence number, passed by the DMA, is between the soft and hard limits, a warning message is issued to the DMA. The token sequence number can never exceed the hard-limit value. version Set the maximum active NDMP protocol version. Valid values are currently 2, 3, and 4. The default is 4. The following property can only be set when using the ndmpadm enable or ndmpadm disable command: auth-type Sets the password encryption type for the authentication of local users. Valid values are cram-md5 or cleartext. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWndmpu, SUNWndmpr | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ SEE ALSO
dump(1), tar(1), ndmpadm(1M), ndmpd(1M), attributes(5), smf(5) SunOS 5.11 3 Mar 2009 ndmp(4)
All times are GMT -4. The time now is 11:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy