简体   繁体   中英

ant: copy file from remote location on windows

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> 

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM