[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A new utility: trv
From: |
James Youngman |
Subject: |
Re: A new utility: trv |
Date: |
Wed, 5 Jan 2005 12:22:53 +0000 |
User-agent: |
Mutt/1.3.28i |
On Tue, Jan 04, 2005 at 09:01:07PM +0100, Giuliano Colla wrote:
> I've written a small utility which I think may be useful.
>
> It's called "trv" (for "traverse"). It will recursively traverse a
> directory tree and execute in each subdirectory the command passed as an
> argument.
Quite a good idea.
Once findutils does the deacent thing...
cat >> $HOME/.env <<EOF
trv() {
find . -type d -execdir "$1" \;
}
EOF
Meanwhile ..
> trv "rm *.pyc"
find . -name "*.pyc" -delete
> trv "touch -r foo *.h"
find . -name "*.h" -exec touch -r foo
> The implementation is so trivial that I'm almost ashamed to propose it,
> bu the idea behind is smart enough to be worth some attention.
An almost identical command comes in the "contrib" directory of the
CVS sources code. One typically uses it for a recursive "cvs add".
James.