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 dir and ./ABC dir. ( not from ./ABC/ABC1 and ./ABC/ABC1/XYZ).

Hence please someone help me to write a correct find command with -prune option.
I beleive the following command will work in Linux find . -name "*.log" -maxdepth 1. But this command is not working in AIX. I'm not sure -maxdepth option is shell dependent or unix flavour variant.

SO i tried find with -prune option but that is not giving me the desired result. (i'm not pretty sure if my find command with -prune option is correct)

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

```text
 and 
```

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:

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