[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] Example: renaming files and files references within

From: Stig Brautaset
Subject: Re: [Gnu-arch-users] Example: renaming files and files references within arch
Date: Thu, 9 Sep 2004 16:33:14 +0100
User-agent: Mutt/1.5.6i

On Thu, Sep 09, 2004 at 03:10:52PM +0000, Mark Stosberg wrote:
> Hello,
> Here's how I solved a need to rename and re-reference a bunch of files
> managed by tla. I wanted to rename all my ".tmpl" files to ".html". The 
> files needed to be moved on the file system, and all code references to
> ".tmpl" updated. Here's how I did it:
>  # 1. Find all files named .tmpl and rename them to .html
>  for f in `find html_root -name '*.tmpl'`; {
>    tla mv $f  `perl -e '($p) = $ARGV[0]; $p =~ 
> s/(.*)\/([\w\-]+).tmpl/$1\/$2.html/; print $p' $f` ;
>  }

>  # 2. while protecting the {arch} directory, rename all references in the 
> code from '.tmpl' to '.html'
>  chmod -R -w '{arch}'
>  grep -Rl '.tmpl' * | xargs perl -pi -e 's/\.tmpl/.html/g'
>  chmod -R +w '{arch}'

I'd probably do something like this:

tla inventory -s | grep '\.tmpl$' | while read f ; do
  tla mv $f `echo $f | sed 's/\.tmpl$/.html/'`

tla inventory -s | while read f ; do
  perl -i -e 's/\.tmpl/.html/g;' $f


reply via email to

[Prev in Thread] Current Thread [Next in Thread]