Sponsored Content
Operating Systems Linux Ubuntu [Solved] Using Find with an exclude/exclude file Post 302566872 by metallica1973 on Friday 21st of October 2011 10:55:28 AM
Old 10-21-2011
[Solved] Using Find with an exclude/exclude file

I am familiar with using tar and exclude/include files:

Code:
tar zcf backup.dirs.tgz --files-from=include.mydirs --exclude-from=exclude.mydirs --no-recursion

but was wondering if I could use find in the same way. I know that you can just specify the directories to exclude but my list is large. Tar is specific which I like:

Code:
find . -depth -ipath './.*' -prune -o -ipath './Downloads*' -prune -o -print

I have to backup specific files from several location and exclude the residual garbage. In my script I have it structure to use find and cpio together and wanted to minimally modify it. So what I want is:

Code:
find (read from and include file) (read from my exclude file) | cpio -oavc > somedir

??
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how do i exclude the current directory when using find?

i want to compile a list of files in all sub directories but exclude the current directory. the closest i could get was to search 'only' the current directory, which is the opposite of what i wanted. find . ! -name . -prune (7 Replies)
Discussion started by: mjays
7 Replies

2. 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

3. 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

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

Exclude a directory in 'find'

Hi, I'm in the process of writing a shell script which will be ran under cron hourly and will check for files of specific age in my ftp folder, then moves those over inside a folder called "old" (which is within the ftp dir). But, I'm unable to figure out how to exclude the "old" folder when... (1 Reply)
Discussion started by: mutex1
1 Replies

6. Shell Programming and Scripting

Find command with exclude

I had a Shell script that removes the files that are in a directory older than the specified days. find /test/files -mtime +10 I would like to add another condition to the find command above that is to exclude any file starting with ‘CGU' Thanks (1 Reply)
Discussion started by: db2dbac
1 Replies

7. UNIX for Dummies Questions & Answers

How to find from / but exclude certain folder?

:)Hi Unix Specialists, I need your advice on how to find all the files from root ( / ) filesystem but exclude those from /export/home (different filesystem) folder. Below are some of the find statements that I have tried without success: find / -name '/export/home' -prune -o print -ls ... (6 Replies)
Discussion started by: gjackson123
6 Replies

8. Shell Programming and Scripting

How-To Exclude Directory in find command

How can i tweak the below find command to exclude directory/s -> "/tmp/logs" find . -type f \( ! -name "*.log*" ! -name "*.jar*" \) -printNote: -path option/argument does not work with the version of find that i have. bash-3.2$ uname -a SunOS mymac 5.10 Generic_150400-26 sun4v sparc sun4v (7 Replies)
Discussion started by: mohtashims
7 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

10. Shell Programming and Scripting

Find and exclude what is in file

Hello everyone, I try to find folders older than 3 years and display them, but excluding some directories, the below code does NOT exclude listed directories: find . -maxdepth 3 -mtime +1095 -type d -exec ls -l {} \; | grep -vFf oldExclude >> older oldExclude Folder1/ Folder2/... (7 Replies)
Discussion started by: Abu Rayane
7 Replies
KANIF.CONF(5)					      kanif.conf configuration file for kanif					     KANIF.CONF(5)

NAME
kanif.conf - configuration file for kanif SYNOPSIS
$HOME/.kanif.conf, /etc/kanif.conf or /etc/c3.conf DESCRIPTION
kanif.conf is the configuration file for kanif. It is optional and only helps the management of static clusters (configurations that do not change much over time). It mimics the syntax of C3 configuration file. It is composed of a sequence of one or more cluster definitions. Each cluster definition is made of the word "cluster" followed by the cluster name and, enclosed in a pair of curly braces : o the front node specification. This is either: o a simple hostname which can be reached from the inside of the cluster (compute nodes). o two names separated by a colon. The first name is the name used from the outside to log on the front node (not used by kanif). The second is the name used from the cluster compute nodes to reach the front node. o an hostname with a colon prepended. This is used for indirect clusters. These are not supported by kanif at this time. o zero or more compute nodes specifications: o a simple hostname (anything that is not of the following form) o an host set made of a prefix, a range and a suffix. o an exclude directive that must follow an host set or another exclude directive. This is made of the word "exclude" followed on the same line by either a single number or an interval between brackets. This applies to the range of the preceding host set. If the exclusion is an interval, the separator between the word "exclude" and this exclusion is optional. o a dead node. The word "dead" followed by the name of the dead node on the same line. Notice that all nodes excluded (using exclude directives or dead nodes) will not take part of the deployment, but are still taken into account in cluster ranges when giving machines specifications to kanif (they are kind of placeholders). This is the interest of specifying nodes as dead or excluded rather than dropping them from the definitions. EXAMPLE
cluster megacluster { # The # character introduce comments megacluster-dev megacluster0[1-9] megacluster[10-64] } cluster supercluster { super-ext:super-int exclude # The host "exclude" super[01-99] exclude 02 # "super02" is excluded exclude[90-95] # "super90" to "super95" are excluded dead # The host "dead" dead othernode # "othernode" is dead } SEE ALSO
kanif(1), taktuk(1) AUTHOR
The author of kanif and current maintainer of the package is Guillaume Huard. Acknowledgements to Lucas Nussbaum for the idea of the name "kanif". COPYRIGHT
kanif is provided under the terms of the GNU General Public License version 2 or later. perl v5.14.2 2012-06-22 KANIF.CONF(5)
All times are GMT -4. The time now is 03:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy