[Top][All Lists]

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

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

From: Mark Stosberg
Subject: [Gnu-arch-users] Example: renaming files and files references within arch
Date: Thu, 9 Sep 2004 15:10:52 +0000 (UTC)
User-agent: slrn/ (FreeBSD)


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}'


Any suggestions for easier ways to accomplish these steps (especially the first?



reply via email to

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