1

I want to move files from my local machine to a mapped drive using ANT. I mapped my Z drive to the below location using using the net use command

  • //IP Address/C$/ShareFolder
  • net use Z: /persistent:yes //IP Address/C$/ShareFolder

I first tried to make the Z drive my todir.

<copy todir="Z:/Results/">
  <fileset dir="${LocalResults}">
    <include name="**/*"/>
  </fileset>
</copy>

Here is the output from Jenkins

[copy] Copying 16 files to Z:\Results
Attempt to copy C:\Program Files\results\index.html to Z:\Results\index.html using NIO Channels failed due to 'failed to create the parent directory for Z:\Results\index.html'.  Falling back to streams.

BUILD FAILED
C:\Deploy\copyResults.xml:69: Failed to copy C:\Program Files\results\index.html to Z:\Results\index.html due to java.io.FileNotFoundException Z:\Results\index.html(The system cannot find the path specified)

If I use the location instead of the mapped drive, it will work.

<copy todir="//IP Address/C$/ShareFolder/Results/">
  <fileset dir="${LocalResults}">
    <include name="**/*"/>
  </fileset>
</copy>

Is there a reason that using the mapped drive in the todir will not work?

TestRaptor
  • 1,305
  • 8
  • 24
  • 42
  • [Have you already read here?](http://stackoverflow.com/questions/23993445/accessing-linux-mount-location-on-windows-through-jenkins/23998101#2399810) – Laba42 Apr 03 '15 at 08:52

1 Answers1

0

Quick question to start, Jenkins is running on a Windows server with a service?

In this case, I think you are not able to use mapped drive (due to the service account).

It's better to work with the folder URL: \\MY_IP\share\drive

Bruno Lavit
  • 10,184
  • 2
  • 32
  • 38