aspose file tools*
The moose likes I/O and Streams and the fly likes Move file to hidden share Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Move file to hidden share" Watch "Move file to hidden share" New topic
Author

Move file to hidden share

Mark Ebbert
Greenhorn

Joined: Nov 29, 2010
Posts: 2
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
Bartender

Joined: Oct 14, 2005
Posts: 18902
    
    8

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

Joined: Nov 29, 2010
Posts: 2
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
Bartender

Joined: Oct 14, 2005
Posts: 18902
    
    8

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

Joined: Oct 27, 2005
Posts: 19760
    
  20

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


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
wood burning stoves
 
subject: Move file to hidden share