Sponsored Content
Top Forums Shell Programming and Scripting Bash find : another problem with prune Post 303043659 by MadeInGermany on Monday 3rd of February 2020 08:56:48 AM
Old 02-03-2020
I guess you have a wrong perception how the pruning works.?
-prune stops descending directories at the current point.
When it is preceded by a condition that becomes true for a directory, then that directory will be skipped.
When it is preceded by a condition that becomes true for a file, then the file and following files will not be excluded, only further directories in that directory will be skipped.

Last edited by MadeInGermany; 02-03-2020 at 10:01 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

find command with prune help

I have a directory named https-abcd Under that I have some directories, files and links. One of those directories is with name logs and the logs directory has lot of files in it. I need to tar the whole https-abcd directory excluding the logs directory only, I should get all the links, files and... (2 Replies)
Discussion started by: venu_nbk
2 Replies

2. UNIX for Dummies Questions & Answers

Using prune with find command

Hi, I am using a find command like below in my script: find /outfiles -type f -name cat -o -name vi -o -name grep 2>/dev/null Which will search for files like "cat" , "vi" or "grep" in the "/outfiles" and subdirectories. I want to ignore a particular subdirectory from the search. I... (4 Replies)
Discussion started by: deepakgang
4 Replies

3. UNIX for Dummies Questions & Answers

Problem using find with prune on large number of files

Hi all; I'm having a problem when want to list a large number of files in current directory using find together with the prune option. First i used this command but it list all the files including those in sub directories: find . -name "*.dat" | xargs ls -ltr Then i modified the command... (2 Replies)
Discussion started by: ashikin_8119
2 Replies

4. Shell Programming and Scripting

find with prune option

Hi, I want to list files only from the current dir and its child dir (not from child's child dir). i have the following files, ./ABC/1.log ./ABC/2.log ./ABC/ABC1/A.log ./ABC/ABC1/B.log ./ABC/ABC1/XYZ/A1.log ./ABC/ABC1/XYZ/A2.log Here i want to list only the log file from current... (1 Reply)
Discussion started by: apsprabhu
1 Replies

5. Shell Programming and Scripting

How to use -path and -prune with find

OK, I'm trying search and destroy tabs again. This time I'm having trouble excluding certain directories from my search. Here is what I have tried and it is not ignoring the top level build directory: find . -path ./build -prune -name \*.java -o -print | xargs grep -i ' ' I don't... (6 Replies)
Discussion started by: siegfried
6 Replies

6. Shell Programming and Scripting

Find + prune + mtime

Hi, i try to catch all files in a dir ,without going down in subdir , which don't have file extension and older than 10 days for example: my dir : drwxr-xr-x 7 notes01 notes 4096 Mar 8 14:11 . drwxr-xr-x 116 root system 4096 Mar 9 11:17 .. -rw-r----- 1 notes01... (4 Replies)
Discussion started by: Nicol
4 Replies

7. UNIX for Dummies Questions & Answers

Find prune Trash

How do I run a find without is looking in ./Trash gregg@gregg-desktop:/media/Audio$ find . -type f ! -name '*.jpg' -size 1M -print |head find: `./.Trash-1000/expunged/2781324553/mp3-to-m4b-batch': Input/output error find:... (0 Replies)
Discussion started by: glev2005
0 Replies

8. UNIX for Dummies Questions & Answers

Find with Prune not working

Hi I am trying to list all files in every subdirectory from a given location. However, I realise that 1 folder will have files that I am not interested in. This is using a .csh file to execute I have tried different scripts but to no avail. My current incarnation is below. Would someone be... (4 Replies)
Discussion started by: wonderbison
4 Replies

9. Shell Programming and Scripting

find: -prune and -name options

I am trying to find all .rhosts files on some unix systems. I tried just -name ".rhosts" but we have a lot of really large NFS and MVFS systems that I do not want to crawl and I am having a hard time excluding them. I also need to scan more than just /root /home and /users, so I really need to scan... (1 Reply)
Discussion started by: nitrobass24
1 Replies

10. Shell Programming and Scripting

Using prune with find

Hi, I have two files under two separate directories as in: find . -name test.sh ./test.sh ./abc/test.sh I want my find to only look for the file test.sh that is under the current directory and not one under /abc How do I use prune to achieve this? I am on AIX (3 Replies)
Discussion started by: swasid
3 Replies
updatedb.conf(5)						File Formats Manual						  updatedb.conf(5)

NAME
/etc/updatedb.conf - a configuration file for updatedb(8) DESCRIPTION
/etc/updatedb.conf is a text file. Blank lines are ignored. A # character outside of a quoted string starts a comment extending until end of line. Other lines must be of the following form: VARIABLE = "VALUE" White space between tokens is ignored. VARIABLE is an alphanumeric string which does not start with a digit. VALUE can contain any char- acter except for ". No escape mechanism is supported within VALUE and there is no way to write VALUE spanning more than one line. Unknown VARIABLE values are considered an error. The defined variables are: PRUNEFS A whitespace-separated list of file system types (as used in /etc/mtab) which should not be scanned by updatedb(8). The file system type matching is case-insensitive. By default, no file system types are skipped. When scanning a file system is skipped, all file systems mounted in the subtree are skipped too, even if their type does not match any entry in PRUNEFS. PRUNENAMES A whitespace-separated list of directory names (without paths) which should not be scanned by updatedb(8). By default, no directory names are skipped. Note that only directories can be specified, and no pattern mechanism (e.g. globbing) is used. PRUNEPATHS A whitespace-separated list of path names of directories which should not be scanned by updatedb(8). Each path name must be exactly in the form in which the directory would be reported by locate(1). By default, no paths are skipped. PRUNE_BIND_MOUNTS One of the strings 0, no, 1 or yes. If PRUNE_BIND_MOUNTS is 1 or yes, bind mounts are not scanned by updatedb(8). All file systems mounted in the subtree of a bind mount are skipped as well, even if they are not bind mounts. As an exception, bind mounts of a directory on itself are not skipped. By default, bind mounts are not skipped. NOTES
When a directory is matched by PRUNEFS, PRUNENAMES or PRUNEPATHS, updatedb(8) does not scan the contents of the directory. The path of the directory itself is, however, entered in the created database. For example, if /tmp is in PRUNEPATHS, locate(1) will not show any files stored in /tmp, but it can show the /tmp directory. This behavior differs from traditional locate implementations. In some updatedb(8) implementations PRUNEPATHS can be used to exclude non-directory files. This is not the case in this implementation. /etc/updatedb.conf is a shell script in some implementations, which allows much more flexibility in defining the variables. Equivalent functionality can be achieved by using the command-line options to updatedb(8). AUTHOR
Miloslav Trmac <mitr@redhat.com> SEE ALSO
locate(1), updatedb(8) mlocate Jun 2008 updatedb.conf(5)
All times are GMT -4. The time now is 10:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy