ant: copy file from remote location on windows

岁酱吖の 提交于 2019-12-24 10:24:22

问题


I want to copy a file present in a shared location to windows machine. Is there some way by which i can specify username and password while copying the file?

If i try to access using copy task, it is giving error saying location does not exist. is it because of permission?

<copy todir="C:/localdir">
    <fileset dir="\\\remotemachinename\dirname"> 
    </fileset> 
</copy> 

回答1:


I think you may have the address wrong.

I just tried the following tests successfully(2 slashes):

dir="\\remotemachinename\dirname"
dir="//remotemachinename/dirname"

But this was unsuccessful (3 backslashes):

dir="\\\remotemachinename\dirname"

However, no password was required for the directory I was accessing.




回答2:


A backslash is an escape character. In order to use a backslash as a backslash you have to use \\ for each slash. So your path should be

\\\\remotemachine\\dirname

Alternatively as sudocode suggests, use a forward slashes instead.



来源:https://stackoverflow.com/questions/9094362/ant-copy-file-from-remote-location-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!