Re: rename a folder
Bob Archer <[email protected]> Wed, 28 Sep 2011 13:17:04 -0400
| Newsgroups | gmane.comp.windows.dotnet.nant.user |
|---|---|
| Message-ID | <[email protected]> |
Yes, supposedly in ant if you do: <move file=”c:/path/to/folder” tofile=”c:/path/to/newfolder” /> It will rename the folder. Since Ant 1.6.3, the file attribute may be used to move (rename) an entire directory. If tofile denotes an existing file, or there is a directory by the same name in todir, the action will fail. I’m not clear if you are supposed to use tofile or todir… since I don’t have ant set up to try it. BOb From: Ryan Boggs [mailto:[email protected]] Sent: Wednesday, September 28, 2011 12:44 PM To: Bob Archer Cc: Khairuddin Abdullah; [email protected] Subject: Re: [NAnt-users] rename a folder Ant does this, you say? Hmmm... Thanks, Ryan On Sep 28, 2011, at 7:02 AM, Bob Archer <[email protected]<mailto:[email protected]>> wrote: Yes, I did see this option, but it seemed like a lot of work to rename a folder. That’s why I asked. I was too lazy to look at the move code to see why it wouldn’t rename a folder, since Ant (I know it’s N(ot)Ant) did. BOb From: Khairuddin Abdullah [mailto:[email protected]] Sent: Tuesday, September 27, 2011 6:51 PM To: Bob Archer Cc: [email protected]<mailto:[email protected]> Subject: Re: [NAnt-users] rename a folder 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 <[email protected]<mailto:[email protected]>> wrote: From: Bob Archer <[email protected]<mailto:[email protected]>> Subject: [NAnt-users] rename a folder To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> 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 [email protected]<mailto:[email protected]> 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 [email protected]<mailto:[email protected]> 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 [email protected] https://lists.sourceforge.net/lists/listinfo/nant-users