Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Move file to hidden share

 
Mark Ebbert
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks again,

Mark Ebbert

 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what's up with that, but you asked for ideas, and I always use jCIFS to work with files which are elsewhere on my Windows network.
 
Mark Ebbert
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:I don't know what's up with that, but you asked for ideas, and I always use jCIFS to work with files which are elsewhere on my Windows network.


Any idea if there are any characters that need escaped? Characters in the path include '$' (because it's hidden), '-' and ' ' (space). Maybe I'll try JCIFS as you suggested.

Thanks for the feedback.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rob Spoor
Sheriff
Pie
Posts: 20669
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic