Question: I want to **find** some files, in a non GNU environment

* in the current directory only
* with extension **\*.ext1** and **\*.ext2**,
* but not **name1.\*** or **name2.\***

The following command works, but may be not efficient, because the shell expands `./*` and **find** can get a huge list of files and directories.

```
find ./* -prune \( -name '*ext1' -o -name '*ext2' \) -a ! \( -name 'name1*' -o -name 'name2*' \)

```

**Update:**

I'm working on AIX, there is no **-maxdepth** option.

Answer: 
In your current directory you can use `ls` with `grep` (assuming your file names don't contain newline characters):

```
ls -a | grep -E '\.ext(1|2)$' | grep -vE '^name(1|2)\.'

```
"In the current directory only" you don't need to `find` files, you can simply list them (with the usual caveats about the possibility of encoutering bizarre file names, containing interesting characters):

```
ls -d *.ext1 *.ext2 2>/dev/null | grep -v '^\(name1\|name2\)\.'

```