[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A new utility: trv
From: |
Giuliano Colla |
Subject: |
A new utility: trv |
Date: |
Tue, 04 Jan 2005 21:01:07 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; it-IT; rv:1.6) Gecko/20040116 |
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.
So, for instance:
trv "rm *.pyc"
will delete all compiled python files in all subdirectories starting
from the cwd.
trv "touch -r foo *.h"
will set all h header files in the directory tree to the timestamp of foo,
etc.
The idea is not mine. It comes from an utility which existed in the
Intel's Rmx386 OS, which was quite Unix-like, but with some smart add-ons.
I'm aware that a number of commands already provide the -R posix option,
but not all of them, and moreover it may be handy to add recursion to
any shell script one decides to write,
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.
If this is of some interest, I may add a few comments, write a man page,
and contribute it.
Or if someone just wants to pick up the idea and do it better, I'll be
glad all the same.
Best regards,
Giuliano Colla
--
Ing. Giuliano Colla
Direttore Tecnico
Copeca srl
Via del Fonditore 3/E
Bologna (Zona Industriale Roveri)
Tel. +39 051 53.46.92 - +39 335 610.43.35
Fax +39 051 53.49.89