使用 ANT 将文件从本地目录复制到映射驱动器
Use ANT to copy files from local directory to a mapped drive
我想使用 ANT 将文件从本地计算机移动到映射的驱动器。我使用 net use 命令
将我的 Z 驱动器映射到以下位置
- //IP Address/C$/ShareFolder
- net use Z: /persistent:yes //IP Address/C$/ShareFolder
我首先尝试让 Z 驱动器成为我的 todir。
<copy todir="Z:/Results/">
<fileset dir="${LocalResults}">
<include name="**/*"/>
</fileset>
</copy>
这是 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)
如果我使用位置而不是映射的驱动器,它将起作用。
<copy todir="//IP Address/C$/ShareFolder/Results/">
<fileset dir="${LocalResults}">
<include name="**/*"/>
</fileset>
</copy>
是否有在 todir 中使用映射驱动器不起作用的原因?
快速提问,Jenkins 运行 在 Windows 服务器上有服务?
在这种情况下,我认为您无法使用映射驱动器(由于服务帐户)。
最好使用文件夹 URL: \\MY_IP\share\drive
我想使用 ANT 将文件从本地计算机移动到映射的驱动器。我使用 net use 命令
将我的 Z 驱动器映射到以下位置- //IP Address/C$/ShareFolder
- net use Z: /persistent:yes //IP Address/C$/ShareFolder
我首先尝试让 Z 驱动器成为我的 todir。
<copy todir="Z:/Results/">
<fileset dir="${LocalResults}">
<include name="**/*"/>
</fileset>
</copy>
这是 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)
如果我使用位置而不是映射的驱动器,它将起作用。
<copy todir="//IP Address/C$/ShareFolder/Results/">
<fileset dir="${LocalResults}">
<include name="**/*"/>
</fileset>
</copy>
是否有在 todir 中使用映射驱动器不起作用的原因?
快速提问,Jenkins 运行 在 Windows 服务器上有服务?
在这种情况下,我认为您无法使用映射驱动器(由于服务帐户)。
最好使用文件夹 URL: \\MY_IP\share\drive