[ALUG] Problem with 'find' and 'basename'

Brett Parker iDunno at sommitrealweird.co.uk
Fri Jun 8 12:38:20 BST 2007


On Fri, Jun 08, 2007 at 12:24:04PM +0100, Chris G wrote:
> 
> The actual command I want to execute is:-
> 
>     find info -name '*.txt' -exec mv `basename {} .txt`.rst \;
> 
> to change the .txt suffix to .rst.

How about this instead...

find info -name '*.txt' -print0 | xargs -0 rename 's/.txt$/.rst/;'

-- 
Brett Parker




More information about the main mailing list