SVN rename all your CakePHP views from thtml to ctp

As I recently moved to Ubuntu 8.04 (plus CompizFusion + AWN which is rocking my world), I am now back to the good old days where bash was there to save my life. So basically I needed to SVN rename (also known as move) all my thtml views to ctp, recursively. Since this is a short tip, I’ll get down to the details. Just cd to your /views path in CakePHP, and issue:

for file in `find . -name "*.thtml"` ; do svn mv $file `echo $file | sed s/\.thtml/\.ctp/` ; done

After that you can safely commit. Enjoy!

No related posts.

Leave a Comment

5 Comments to "SVN rename all your CakePHP views from thtml to ctp"

  1. May282008 at 5:19 pm

    Dieter_be [Visitor] wrote:

    Be careful. You should put double quotes (“”) around your $file (“$file”) to protect from special characters – such as spaces – in your filenames.

  2. May282008 at 6:55 pm

    mariano.iglesias [Member] wrote:

    @Dieter_be: good thinking, though I doubt you could get away with a CakePHP view with a space on it :)

  3. May282008 at 8:40 pm

    Mario César [Visitor] wrote:

    Thanks ! thank you very much ! :D

  4. May292008 at 3:11 am

    squawk [Visitor] wrote:

    You can also use the -exec flag in find:

    find . -name “*.thtml” -exec svn mv {} `echo {} | sed s/\.ctp/\.thtml/` \;

  5. Jul072008 at 6:46 am

    dr. Hannibal Lecter [Visitor] wrote:

    Man, sometimes I’d just like to kick some bottoms when I see the poor “command line interface” Windoze has. :-(

    So many great things on Unix/Linux…

Powered by Wordpress and MySQL. Clauz's design for by Cricava