[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/'`
done
tla inventory -s | while read f ; do
perl -i -e 's/\.tmpl/.html/g;' $f
done
Stig
- [Gnu-arch-users] Example: renaming files and files references within arch, Mark Stosberg, 2004/09/09
- Re: [Gnu-arch-users] Example: renaming files and files references within arch, Jani Monoses, 2004/09/09
- Re: [Gnu-arch-users] Example: renaming files and files references within arch, David Allouche, 2004/09/09
- Re: [Gnu-arch-users] Example: renaming files and files references within arch, Gergely Nagy, 2004/09/09
- Re: [Gnu-arch-users] Example: renaming files and files references within arch, Aaron Bentley, 2004/09/09
- Re: [Gnu-arch-users] Example: renaming files and files references within arch,
Stig Brautaset <=
- Re: [Gnu-arch-users] Example: renaming files and files references within arch, Miles Bader, 2004/09/09