My requirement is to transfer files (download/upload) from a remote windows shared drive. I'm using JCIFS API to achieve it. I'm able to connect & download files from there. The issue is when the folder name on the remote machine has spaces, my code is failing with "Failed to connect to server" error.
Below is the code snippet
When executed, I'm getting SMB exception. When tried with folders without spaces, its working absolutely fine. Would you please help me out?
jcifs.smb.SmbException: Failed to connect to server
java.net.UnknownHostException: \\HostIP\Trans-serv\1_NBWCPSUP\Test Files\My Folder-Cycle 1\hi.txt
You have to put the entire path in quotes (escaped double quotes) to make sure windows keeps the path together as one term instead of splitting it at the spaces.
Joined: Jun 04, 2012
Thanks for your response. I've figured it out. The problem is with the string "smb://". For some reason, its not accepting this as the correct URL format. I've modified it as below
and it worked.
The other problem, I forget to address is the File transfer rate. It is taking approximately 2 min. to download 9MB file which I feel is very less. I've tried several ways with changing the buffer size, but it doesn't help significantly. Is there any way to improve the performance?