Sponsored Content
Full Discussion: find with prune option
Top Forums Shell Programming and Scripting find with prune option Post 302357908 by zaxxon on Thursday 1st of October 2009 01:01:30 AM
Old 10-01-2009
To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums

****************************************************

AIX find is different from for example Linux' find. Checking the man pages you can see what is available. On AIX there is no -maxdepth; so I would try to parse the output of find maybe like filtering how many slashes are in the output for example. In your example you could check if there are more than 4 slashes in the output and if yes do not print.

Example with filtering more than 3 slashes:
Code:
$> find ./a
./a
./a/b
./a/b/1
./a/b/2
./a/b/c
./a/b/c/4
./a/b/c/d
./a/b/c/d/6
./a/b/c/d/5
./a/b/c/3
$> find ./a| grep -v \.\/[^\/]\/[^\/]\/[^\/]\/.*
./a
./a/b
./a/b/1
./a/b/2
./a/b/c

Other alternative could be to install find from the Linux Tools CD or download it from IBM freeware site and install it - using a link with a name like "gfind" so you know its GNU find and not AIX find.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

finding files using prune option

Hi All, I am trying to find files in a directory and don't want to search in the sub directories and using the command find . \( ! -name . -prune \) -mtime +1 -name '*.log' and is working fine. But when I am trying with absolute path then is not working like find /home/subodh \( ! -name... (1 Reply)
Discussion started by: subodh.sharma
1 Replies

2. Solaris

correct usage of find's -prune option

I know one of the more seasoned veterans probably opened this thread looking for their chance to refer me to the site's search feature and let me tell you. I'VE LOOKED!!!! And I didn't find anything helpful... So, I've got a windows background and I'm fond of its search feature which comes... (6 Replies)
Discussion started by: ProGrammar
6 Replies

3. Linux

doubt in -prune option

i want to find only the file t4 in directory t3. i am in dir t . the tree is as follows. if i give, find . o/p is . ./t4 ./t1 ./t1/t2 ./t1/t2/t3 ./t1/t2/t3/t4 ./t1/t2/t4 ./t1/t4 directories are like t/t1/t2/t3 and each directory has file t4. my question is , i want to find file... (0 Replies)
Discussion started by: bhuvaneshlal
0 Replies

4. UNIX for Dummies Questions & Answers

help me out with find command , -prune option

Hi , Kindly help me out .:) i want to find only the file t4 in directory t3. i am in dir t . the tree is as follows. if i give, find . o/p is . ./t4 ./t1 ./t1/t2 ./t1/t2/t3 ./t1/t2/t3/t4 ./t1/t2/t4 ./t1/t4 directories are like t/t1/t2/t3 and each directory has file t4. my... (7 Replies)
Discussion started by: bhuvaneshlal
7 Replies

5. Shell Programming and Scripting

help with find command and prune option

Hi I have a directory say mydir and inside it there are many files and subdirectories and also a directory called lost+found owned by root user I want to print all files directories and subdirectorres from my directory using find command except lost+found If i do find . \( -name... (3 Replies)
Discussion started by: xiamin
3 Replies

6. Shell Programming and Scripting

recently introduced to the newer option for find...does an older option exist?

To find all the files in your home directory that have been edited in some way since the last tar file, use this command: find . -newer backup.tar.gz Is anyone familiar with an older solution? looking to identify files older then 15mins across several directories. thanks, manny (2 Replies)
Discussion started by: mr_manny
2 Replies

7. UNIX for Dummies Questions & Answers

AIX find command using prune option

Hi, I am trying to find some files in a directory and then remove/list them if they are 30 days old. I also have 2 directories in that directory which I need to skip. Can someone please tell me what is the correct syntax? find /developer/. -name "lost+found" "projects" -prune -o -type f... (2 Replies)
Discussion started by: tkhan9
2 Replies

8. UNIX for Dummies Questions & Answers

find with prune option help needed

Hello, I am using ksh93 (/usr/dt/bin/dtksh) on Solaris and am stuck when trying to use find with the -prune option. I need to search a directory (supplied in a variable) for files matching a certain pattern, but ignore any sub-directories. I have tried: find ${full_path_to_dir_to_search}... (9 Replies)
Discussion started by: gary_w
9 Replies

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

10. UNIX for Beginners Questions & Answers

Prune Option for Find Command on AIX

I need to delete all files from the working directory and its sub directories using the find command, for that I am using -prune option but some how I am having a syntax issue. I have tried the below, please help me correct the syntax find . -name \* -type f -exec rm -f {} \; >> Works but... (4 Replies)
Discussion started by: rosebud123
4 Replies
Ns_Exec(3aolserver)					   AOLserver Library Procedures 				       Ns_Exec(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
Ns_ExecArgblk, Ns_ExecArgv, Ns_ExecProc, Ns_ExecProcess, Ns_Fork, Ns_GetEnviron, Ns_WaitForProcess, Ns_WaitProcess, ns_fork - External process execution SYNOPSIS
#include "ns.h" int Ns_ExecArgblk(char *exec, char *dir, int fdin, int fdout, char *args, Ns_Set *env) int Ns_ExecArgv(char *exec, char *dir, int fdin, int fdout, char **argv, Ns_Set *env) int Ns_ExecProc(char *exec, char **argv) int Ns_ExecProcess(char *exec, char *dir, int fdin, int fdout, char *args, Ns_Set *env) int Ns_Fork(void) char **Ns_GetEnviron(void) int Ns_WaitForProcess(int pid, int *statusPtr) int Ns_WaitProcess(int pid) int ns_fork(void) _________________________________________________________________ DESCRIPTION
These functions handle fork and exec operations. See files: nsd/exec.c, nsd/tclenv.c and nsthread/fork.c. Ns_ExecArgblk(exec, dir, fdin, fdout, args, env) Executes a command in a child process. Return process id of child process exec'ing the command or -1 on failure. Provides extended error checking and error messages. Ns_ExecArgv(exec, dir, fdin, fdout, argv, env) Execute a command in a child process using fork(2) and execve(2), returns the process id of child process exec'ing the command or -1 on failure. The child sends an extended error message to the parent. Ns_ExecProc(exec, argv) Executes a command in a child process. Returns the process id of the child process exec'ing the command or -1 on failure. Simpli- fies call to Ns_ExecArgv. Ns_ExecProcess(exec, dir, fdin, fdout, args, env) Executes a command in a child process. Returns the process id of the child process exec'ing the command or -1 on failure. Calls Ns_ExecArgblk with same arguments. Ns_Fork() Posix style fork(), using fork1() on Solaris if needed. See fork(2) man page. Calls ns_fork. Ns_GetEnviron() Returns pointer to the environment vector. Ns_WaitForProcess(pid, statusPtr) Wait for child process. Returns NS_OK on success, or NS_ERROR on failure. *statusPtr is set to the exit code of the child process. Ns_WaitProcess(pid) Wait for child process. Calls Ns_WaitForProcess with NULL statusPtr. Returns NS_OK on success, or NS_ERROR on failure. ns_fork() Posix style fork(), using fork1() on Solaris if needed. SEE ALSO
nsd(1), info(n) KEYWORDS
AOLserver 4.0 Ns_Exec(3aolserver)
All times are GMT -4. The time now is 01:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy