I am trying to copy a file which is at remote machine shared folder using following code.
myMethod (String paramUrl) { //URL of the folder shared on Remote machine
logger.info("paramUrl="+paramUrl);
URL url = new URL(paramUrl);
logger.info("Source file address="+url.getFile());
File inFile = new File(url.getFile());
String destFileName = "D://LOCAL_FOLDER+"//"+xyz.xml;
logger.info("destFileName="+destFileName);
File destFile = new File(destFileName);
FileUtils.copyFile(inFile, destFile);
}
::::output is:::::::
paramUrl=file:////10.0.0.3//SHARED_FOLDER//xyz.xml
Source file address=////10.0.0.3//SHARED_FOLDER//xyz.xml
destFileName=D:/LOCAL_FOLDER//xyz.xml
java.io.FileNotFoundException: Source '\\10.0.0.3\SHARED_FOLDER\xyz.xml' does not exist
at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:637)
Note:
If I try to access the URL "\\10.0.0.3\SHARED_FOLDER" it works fine using RUN (in Windows). Folder shared with read/write permission for everyone.
Also If I share local-folder and tried to access from same machine using URL "////localhost//LOCAL_SHARED_FOLDER/xyz.xml" my code works fine.
But I do not know, why it is not working for remote-machine ip-address,Please guys help me why it is not working