Bob:
 
Try the following on one or two folders as a test (make sure you create a back 
up, just in case). If you do not wish to purge old empty folders (with 
Company.* in name), you need to comment out the last delete line.  Good luck!
 
      <foreach item="Folder" property="folderpath">
                                <in>
                                     <items>
                                          <include 
name="C:\Builds\TestRename\8.0.0.4\Company.*" />
                                    </items>
                                 </in>
                                <do>
                                 <echo message="${folderpath}" />
                                <echo message="${string::replace(folderpath, 
'Company.', '')}"/>
                                <move todir="${string::replace(folderpath, 
'Company.', '')}">
                                     <fileset basedir="${folderpath}">
                                         <include name="*.*" />
                                     </fileset>
                                </move>
                                  <!-- commented out the following delete line 
if you do not want to purge old empty folders -->
                                      <delete dir="${folderpath}" />
                                </do>
             </foreach>

--- On Tue, 9/27/11, Bob Archer <bob.arc...@amsi.com> wrote:


From: Bob Archer <bob.arc...@amsi.com>
Subject: [NAnt-users] rename a folder
To: "nant-users@lists.sourceforge.net" <nant-users@lists.sourceforge.net>
Date: Tuesday, September 27, 2011, 5:49 PM






Seriously, this should be easy but it is not.
 
I want to rename folders.. but the move doesn’t seem to want to. Can move 
rename a folder. Any examples?
 
I am doing something like this:
 
<?xml version="1.0" ?>
<project name="TestRename" default="info">
 
                <foreach item="Folder" property="folderpath">
                                <in>
                                                <items 
basedir="C:\Builds\TestRename\8.0.0.4">
                                                                <include 
name="Company.*" />
                                                </items>
                                </in>
                                <do>
                                                <echo message="${folderpath}" />
                                                <echo 
message="${string::replace(folderpath, 'Company.', '')}"/>
                                                <move file="${folderpath}" 
todir="${string::replace(folderpath, 'Company.', '')}" verbose="true" />
                                </do>
                </foreach>
 
</project>
 
I’ve tried todir and tofile.  If I remark out the move the correct paths are 
displayed as messages.
 
BOb
 
-----Inline Attachment Follows-----


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
-----Inline Attachment Follows-----


_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to