I find it difficult to believe this hasn't been asked/answered before, but I have not been able to find a related thread anywhere on 'the google.' I appreciate any help.
The problem I'm having is trying to move a file from a local disk to a hidden share. I actually have to move two different files to two different shares, but only one of the shares is hidden. The move involving the unhidden share works fine. I should also mention that the hidden share does not require any authentication (don't ask me why).
The error I'm getting is that the directory does not exist. I've tried doing the move with both the 'renameTo' function in Java.io.File as well as using Apache FileUtils.moveToDirectory. I do not see any mention of hidden shares on the API pages for ether method.
Here is an example of the share path:
\\server\hidden_share$\Name of Folder\name_of_file.jpg
Thus, in my java properties file, I write the path as:
\\\\server\\hidden_share$\\Name of Folder\\name_of_file.jpg
Am I missing something obvious? Any thoughts/ides?
Mark Ebbert wrote:Any idea if there are any characters that need escaped? Characters in the path include '$' (because it's hidden), '-' and ' ' (space).
As far as file names are concerned, I'm sure you can use '-' and space without any escaping. I wouldn't expect to have to escape '$' either but I don't think I ever tried it. They don't have to be escaped in Properties files either, I just looked it up.
I've tried on my network here, and it works here like a charm. I can list the children of the folder (with spaces in it), and when I call exists() on the file it returns true. Are you sure the user that the JVM is running as has enough rights for:
- the share
- the folder
- the file