Question: How can I make `find` apply my shell's defined functions and aliases inside its *exec* parameter?

For example I have defined a function analogous to **bzip2** but using **7z**:

> 
> function 7zip() { for f in $@; do ls -alF "$f"; 7za a -t7z -m0=lzma
>  -mx=9 -mfb=64 -md=64m -ms=on "$f.7z" "$f" && touch -r "$f" "$f.7z" && rm -fv "$f" && ls -alF "$f.7z"; done; }
> 
> 
> 

When I find files older than 7 days to compress:

```
find . -mtime +7  -name "G*.html"   -execdir  7zip {}  + 

```

Rather than expanding **7zip** it errors Command Not Found.

This is all inside a shell script.

Answer: 
You can export a function definition with:

```
export -f 7zipi

```

but using an indentifier whose name begins with a number is asking for trouble. Try changing the name to something sensible. (eg "f7zipi", or "\_7zipi")
Seems that not every `find` will accept a function as an argument for `--execdir`. It did not work for me either in the original form or using `export -f`.

However, if your make a script out of your function, it will work

```
find . -mtime +7 -name "G*.html" -execdir  /path/to/script_7zipi {} +

```