Sponsored Content
Top Forums UNIX for Dummies Questions & Answers cmd find: exclude directory when using option -depth Post 302605915 by bora99 on Friday 9th of March 2012 03:54:45 AM
Old 03-09-2012
cmd find: exclude directory when using option -depth

hello,

i want to use "-depth" in command "find" and want to exclude a directory.
the find command should work in HP-UX and Linux.
Code:
i see in the find man page:
-prune
    If -depth is not given, true; do not descend the current directory.
    If -depth is given, false; no effect. 

-depth
    Process each directory's contents before the directory itself.

so my tests , in the example in want to exclude directory "excludedir", only the example with "-path" works , is there another option to use "-prune" and "-depth" ?

OK
Code:
find . -depth ! \( -path "./excludedir/*" -o -type d -name excludedir -prune \) -print

OK
Code:
find . ! \( -name excludedir -type d -prune \) -print

NOTOK
Code:
find . -depth ! \( -name excludedir -type d -prune \) -print

NOTOK , syntax error in Linux:
Code:
find . ! \( -name excludedir -type d -prune \) -depth -print

find: warning: you have specified the -depth option after a non-option argument !,
but options are not positional (-depth affects tests specified before it as well as those
specified after it). Please specify options before other arguments.

regards
 

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

TAR : option to exclude absolute path

Dear All , :D I have a question ... I need to exclude the absolute path in the TAR process. For example : system("tar cvf /root/BACKUPS_$fecha.tar /root/BKP/"); system("gzip /root/BACKUPS_$fecha.tar"); I need to exclude de path " /root/BKP/ " in the file.tar.gz What is the parameter to... (1 Reply)
Discussion started by: telco
1 Replies

3. Shell Programming and Scripting

How to exclude top level directory with find?

I'm using bash on cygwin/windows. I'm trying to use find and exclude the directory /cygdrive/c/System\ Volume\ Information. When I try to use the command below I get the error "rm: cannot remove `/cygdrive/c/System Volume Information': Is a directory. Can someone tell me what I am doing... (3 Replies)
Discussion started by: siegfried
3 Replies

4. Shell Programming and Scripting

rsync exclude option

Hi Frdz, i am using rsync to transfer files from source to destination. but i have one criteria like i have to tranfer only links from source to destination. in home/test/po folder i have kiran/test1 -> /home/test/lo/fg kiran/test2 -> /home/test/lo/fg2 like links are available.... (1 Reply)
Discussion started by: KiranKumarKarre
1 Replies

5. Shell Programming and Scripting

complicated exclude option in find command

Hi all, In a directory, I have many video files. Example : As you can see, some of the video files come with a .aspx file (wich means the video is actually being uploaded and not entirely written on the FS) I try to write a bash script that would find all video files in the ... (1 Reply)
Discussion started by: gniagnia
1 Replies

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

7. Shell Programming and Scripting

SunOS: How to exclude directory in find command?

Hi All, First my OS version is: ksh:0$ uname -a SunOS 5.9 Generic_122300-48 sun4u sparc SUNW,Sun-Fire-V440 I want to exclude the following DIR(./country111) in my search pattern: ksh:0$ find . -name "*.tar" ./country111/COUNTRY_BATCH-801.tar ./country111/COUNTRY_BATCH-802.tar... (3 Replies)
Discussion started by: saps19
3 Replies

8. Ubuntu

[Solved] Using Find with an exclude/exclude file

I am familiar with using tar and exclude/include files: 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... (2 Replies)
Discussion started by: metallica1973
2 Replies

9. Shell Programming and Scripting

Understand the importance of -depth option in find command.

Hi All, Can you please help me in understanding the importance of -depth of find. I am trying to execute below code.find . -mtime +5 -name "*" -depth -exec ls -l {} \; But it is throwing below error.find: warning: you have specified the -depth option after a non-option argument -mtime,... (2 Replies)
Discussion started by: Girish19
2 Replies

10. 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
PYCALLGRAPH(1)							   User Commands						    PYCALLGRAPH(1)

NAME
pycallgraph - command-line interface to pycallgraph SYNOPSIS
pycallgraph [OPTION]... pythonfile DESCRIPTION
This manual page documents pycallgraph. This manual page was originally written for the Debian distribution. pycallgraph is a program that creates call graphs for Python programs. pycallgraph is the command line interface to pycallgraph's make_dot_graph method, which generates a call graph and stores it as an image in the specified image file. -o, --output-file the file name of the output image. Default: pycallgraph.png -f, --image-format the image format of imagefile. Default: png -q, --quiet Suppress status output to the console. -t, --tool the tool from GraphViz to use. Default: dot -s, --stdlib include standard library functions in the trace. Default: False -i, --include wildcard pattern of modules to include in the output. You can have multiple include arguments -e, --exclude wildcard pattern of modules to exclude in the output. You can have multiple exclude arguments -d, --max-depth maximum stack depth to trace --exclude-timing wildcard pattern of modules to exclude in time measurement. You can have multiple exclude arguments --include-timing wildcard pattern of modules to include in time measurement. You can have multiple include arguments EXAMPLES
Create a call graph called pycallgraph.png on myprogram.py: pycallgraph ./myprogram.py Create a call graph of a standard Python installation script with command line parameters: pycallgraph --output-file=setup.png -- setup.py --dry-run install Only see the module "distutils" within the execution of easy_install: pycallgraph --include=distutils.* /usr/bin/easy_install AUTHORS
pycallgraph and pycallgraph were written by Gerald Kaszuba <pycallgraph@slowchop.com>. This manual page was originally written by Jan Alonzo <jmalonzo@unpluggable.com>, for the Debian GNU/Linux system. pycallgraph version 0.5.1 2008-07-08 PYCALLGRAPH(1)
All times are GMT -4. The time now is 06:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy