Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: executing commands in directories containing specific files



On Tue, Feb 11, 2014 at 7:35 PM, Jan Larres <jan@xxxxxxxxxxxxxx> wrote:

> On 12/02/14 13:11, Leonardo Barbosa wrote:
> > I'd like to find TeX files (find $HOME -type f -name '*.tex'). Let's say
> i
> > have found files a.tex, b.tex, and c.tex. Now, i wanna remove a.aux,
> b.aux,
> > c.aux. What's the best way of doing that?
>
> find $HOME -type f -name '*.tex' -exec rm {} \;
>
>
That won't get the aux files

I would use

for f in $HOME/**/*.tex; do rm $f; rm ${f:r}.aux; done


Messages sorted by: Reverse Date, Date, Thread, Author