<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to recursively rename directories using a regexp</title>
	<atom:link href="http://thibauld.com/2009/02/how-to-recursively-rename-directories-using-a-regexp/feed/" rel="self" type="application/rss+xml" />
	<link>http://thibauld.com/2009/02/how-to-recursively-rename-directories-using-a-regexp/</link>
	<description>- Imagination and Execution -</description>
	<lastBuildDate>Wed, 08 Sep 2010 22:42:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Pierrick LE GALL</title>
		<link>http://thibauld.com/2009/02/how-to-recursively-rename-directories-using-a-regexp/comment-page-1/#comment-127</link>
		<dc:creator>Pierrick LE GALL</dc:creator>
		<pubDate>Tue, 24 Feb 2009 16:33:30 +0000</pubDate>
		<guid isPermaLink="false">http://thibauld.com/?p=158#comment-127</guid>
		<description>I do prefer using Perl for this kind of small task:

find . -type d -name &quot;*-test&quot; &#124; sort -r &#124; perl -ne &#039;chomp; $on=$_; $nn=$_; $nn =~ s/-test$//; print &quot;mv $on $nn\n&quot;&#039; &#124; bash

The advantage is that you can prepare the commands to execute and once it&#039;s OK, you add the &quot; &#124; bash&quot; at the end of the command.

Warning: don&#039;t forget to add the &quot;sort -r&quot; because if you have nested &quot;*-test&quot; directories, it will first move the nested directories.

thibs.orig
thibs.orig/b
thibs.orig/b/ba
thibs.orig/b/ba/baa
thibs.orig/b/ba/bab-test
thibs.orig/a-test
thibs.orig/a-test/aa
thibs.orig/a-test/aa/aaa-test

thibs
thibs/a
thibs/a/aa
thibs/a/aa/aaa
thibs/b
thibs/b/ba
thibs/b/ba/baa
thibs/b/ba/bab</description>
		<content:encoded><![CDATA[<p>I do prefer using Perl for this kind of small task:</p>
<p>find . -type d -name &#8220;*-test&#8221; | sort -r | perl -ne &#8216;chomp; $on=$_; $nn=$_; $nn =~ s/-test$//; print &#8220;mv $on $nn\n&#8221;&#8216; | bash</p>
<p>The advantage is that you can prepare the commands to execute and once it&#8217;s OK, you add the &#8221; | bash&#8221; at the end of the command.</p>
<p>Warning: don&#8217;t forget to add the &#8220;sort -r&#8221; because if you have nested &#8220;*-test&#8221; directories, it will first move the nested directories.</p>
<p>thibs.orig<br />
thibs.orig/b<br />
thibs.orig/b/ba<br />
thibs.orig/b/ba/baa<br />
thibs.orig/b/ba/bab-test<br />
thibs.orig/a-test<br />
thibs.orig/a-test/aa<br />
thibs.orig/a-test/aa/aaa-test</p>
<p>thibs<br />
thibs/a<br />
thibs/a/aa<br />
thibs/a/aa/aaa<br />
thibs/b<br />
thibs/b/ba<br />
thibs/b/ba/baa<br />
thibs/b/ba/bab</p>
]]></content:encoded>
	</item>
</channel>
</rss>
