New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Directory #11

Closed
fastcat opened this Issue Dec 15, 2011 · 7 comments

Comments

Projects
None yet
3 participants
@fastcat

fastcat commented Dec 15, 2011

Currently the move task does not seem able to rename directories. It looks like there was an attempt to fix this just before the 0.91 release, but it was reverted.

Renaming directories (instead of moving the contents of one directory into another) can be an important feature for doing deployments.

@rmboggs

This comment has been minimized.

Show comment
Hide comment
@rmboggs

rmboggs Dec 15, 2011

Member

Just a bit of background as I believe you are referencing some of the work that I did to the move task that was backed out prior to 0.91 release. That work was to introduce a simplified way of moving entire directories with the move task. It was backed out because there was question/concern with the proposed syntax as well as how it functioned internally. I do have plans of taking another stab at it but it'll take a bit of time.
In the meantime, the move task today can move entire directories with the following example:

<move tofile="target/dir">
  <fileset basedir="source/dir"/>
</move>

It's a bit of a wrist cramper but it works.

Hope this adds clarity.

Member

rmboggs commented Dec 15, 2011

Just a bit of background as I believe you are referencing some of the work that I did to the move task that was backed out prior to 0.91 release. That work was to introduce a simplified way of moving entire directories with the move task. It was backed out because there was question/concern with the proposed syntax as well as how it functioned internally. I do have plans of taking another stab at it but it'll take a bit of time.
In the meantime, the move task today can move entire directories with the following example:

<move tofile="target/dir">
  <fileset basedir="source/dir"/>
</move>

It's a bit of a wrist cramper but it works.

Hope this adds clarity.

@ghost ghost assigned rmboggs Dec 15, 2011

@fastcat

This comment has been minimized.

Show comment
Hide comment
@fastcat

fastcat Dec 15, 2011

I found that in the documentation, but it doesn't seem to actually work. It in fact seems to do nothing. For example:

  <target name="build">
    <mkdir dir="a"/>
    <mkdir dir="a/test"/>
    <touch file="a/test/stamp" />
    <move tofile="b" verbose="true" includeemptydirs="true">
      <fileset basedir="a" />
    </move>
  </target>

produces:

build:

   [delete] Deleting directory 'C:\src\nantest\a'.
    [mkdir] Creating directory 'C:\src\nantest\a'.
    [mkdir] Creating directory 'C:\src\nantest\a\test'.

The mkdir and touch calls do their thing, but when it gets to the move task, it seems to silently decide that there's nothing it needs to do. No messages, warnings, or errors.

If I change tofile to todir, and add an in the fileset, then it moves all the files over, but leaves all the directories behind.

I ended up resorting to calling out to cmd.exe via the exec task for my scenario, esp. since it's important for me that the directory rename be atomic, and not leave partial results behind if there is a file locking error.

fastcat commented Dec 15, 2011

I found that in the documentation, but it doesn't seem to actually work. It in fact seems to do nothing. For example:

  <target name="build">
    <mkdir dir="a"/>
    <mkdir dir="a/test"/>
    <touch file="a/test/stamp" />
    <move tofile="b" verbose="true" includeemptydirs="true">
      <fileset basedir="a" />
    </move>
  </target>

produces:

build:

   [delete] Deleting directory 'C:\src\nantest\a'.
    [mkdir] Creating directory 'C:\src\nantest\a'.
    [mkdir] Creating directory 'C:\src\nantest\a\test'.

The mkdir and touch calls do their thing, but when it gets to the move task, it seems to silently decide that there's nothing it needs to do. No messages, warnings, or errors.

If I change tofile to todir, and add an in the fileset, then it moves all the files over, but leaves all the directories behind.

I ended up resorting to calling out to cmd.exe via the exec task for my scenario, esp. since it's important for me that the directory rename be atomic, and not leave partial results behind if there is a file locking error.

@rmboggs

This comment has been minimized.

Show comment
Hide comment
@rmboggs

rmboggs Dec 15, 2011

Member

Ok, I'll take a look.

Member

rmboggs commented Dec 15, 2011

Ok, I'll take a look.

@rmboggs

This comment has been minimized.

Show comment
Hide comment
@rmboggs

rmboggs Dec 23, 2011

Member

Yeah, there is an issue here. This task is assigned to me. My work for this issue will be done here.

Member

rmboggs commented Dec 23, 2011

Yeah, there is an issue here. This task is assigned to me. My work for this issue will be done here.

@rmboggs

This comment has been minimized.

Show comment
Hide comment
@rmboggs

rmboggs Mar 16, 2012

Member

I believe I have addressed this issue in the referenced pull request but it needs review. If you are interested, please take a look and see if this fixes it.

Member

rmboggs commented Mar 16, 2012

I believe I have addressed this issue in the referenced pull request but it needs review. If you are interested, please take a look and see if this fixes it.

@rmboggs

This comment has been minimized.

Show comment
Hide comment
@rmboggs

rmboggs Apr 9, 2012

Member

Just merged Pull Request #39 that should address this issue. The next nightly build (should be built tomorrow) should have this fix included. In the meantime, I'll close this ticket.

Member

rmboggs commented Apr 9, 2012

Just merged Pull Request #39 that should address this issue. The next nightly build (should be built tomorrow) should have this fix included. In the meantime, I'll close this ticket.

@rmboggs rmboggs closed this Apr 9, 2012

rmboggs pushed a commit to rmboggs/nant that referenced this issue Sep 29, 2013

Ryan Boggs
Reverts fix for issue #11 due to unforeseen impact to other common co…
…py/move task scenarios. Addresses Issue #88, Issue #85, and Issue #65.

Added CopyTask test to account for reported issue to avoid future complications.
@patricktoohey

This comment has been minimized.

Show comment
Hide comment
@patricktoohey

patricktoohey May 23, 2014

think your syntax is just wrong. should use todir not to file. try...

On Fri, May 23, 2014 at 11:33 AM, andrewducker notifications@github.comwrote:

I'm trying to do this - and failing. If I use the following then I get an
exception:

System.NullReferenceException: Object reference not set to an instance of
an object.
at
NAnt.Core.Tasks.CopyTask.FileOperation.TargetDirectoryDoesNotExist(DirectoryInfo
source, DirectoryInfo target)
at NAnt.Core.Tasks.CopyTask.ExecuteTask()

Is this related to the above error? We're using Nant 0.92


Reply to this email directly or view it on GitHubhttps://github.com/nant/nant/issues/11#issuecomment-44026211
.

think your syntax is just wrong. should use todir not to file. try...

On Fri, May 23, 2014 at 11:33 AM, andrewducker notifications@github.comwrote:

I'm trying to do this - and failing. If I use the following then I get an
exception:

System.NullReferenceException: Object reference not set to an instance of
an object.
at
NAnt.Core.Tasks.CopyTask.FileOperation.TargetDirectoryDoesNotExist(DirectoryInfo
source, DirectoryInfo target)
at NAnt.Core.Tasks.CopyTask.ExecuteTask()

Is this related to the above error? We're using Nant 0.92


Reply to this email directly or view it on GitHubhttps://github.com/nant/nant/issues/11#issuecomment-44026211
.

aleshi added a commit to aleshi/nant that referenced this issue May 3, 2017

Reverts fix for issue #11 due to unforeseen impact to other common co…
…py/move task scenarios. Addresses Issue #88, Issue #85, and Issue #65.

Added CopyTask test to account for reported issue to avoid future complications.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment