0

I wanted to check if the given file path(can be shared path,local path on remote windows server) on remote windows machine is existing,is directory and has write permissions from windows machine.

I will be supplied with remote host name, userid,password and file path.

I am using java 1.6

for example:

from my windows machine, I need to access \\ABDCDMACHINE\DDRIVE\FFOLDER\XXFILE

I know this can be done using File API. methods in this API, takes parameter of URI/URL, but I want to know how form URL with user name and password included in it.

mahesh
  • 1,523
  • 4
  • 23
  • 39
  • Please show a little bit of effort. Writing "urgent" is not going to convince anyone to help you. What have you done so far? – Vivin Paliath Feb 12 '14 at 17:00
  • This might help http://stackoverflow.com/questions/2011264/how-to-read-a-file-from-remote-system-using-java – Vivek Vermani Feb 12 '14 at 17:00
  • I have done for local path – mahesh Feb 12 '14 at 17:02
  • I meant code. Show us what you've tried so far on your own. – Vivin Paliath Feb 12 '14 at 17:03
  • @Vivek, the link does not show any example of passing credentials and accessing the file path. – mahesh Feb 12 '14 at 17:03
  • @Vivin, If I know which class to use to access the remote path ,then I would have not asked any question mostly. – mahesh Feb 12 '14 at 17:04
  • Did you try googling? The first thing that pops up is the `File` API. See [here](http://docs.oracle.com/javase/tutorial/essential/io/fileio.html); there is a link to the older File I/O API from Java 6 as well. – Vivin Paliath Feb 12 '14 at 17:04
  • @Vivin, I looked at this API, I could not find way to pass the credentails to the reomote server, if you know you may help , as I don't have much time to read complete documentation. – mahesh Feb 12 '14 at 17:08
  • 1
    This is what I got after googling for "java file i/o remote windows share credentials"; it's even on [stackoverflow](http://stackoverflow.com/questions/10599999/write-i-o-file-to-shared-network-drive-using-credentials). – Vivin Paliath Feb 12 '14 at 18:14
  • thanks Vivin. I got the below.http://stackoverflow.com/questions/11724576/read-remote-file-in-java-which-needs-username-and-password – mahesh Feb 12 '14 at 18:27
  • If you have found a solution for your question, please post it as an answer and mark it as accepted. – Kelly S. French Feb 12 '14 at 19:28
  • @vivin, I have a question, can we use this third party libraries in the real time development. because I am working for a client – mahesh Feb 12 '14 at 19:28
  • @Kelly S. French, SO will not allow me to accept answer less than 2 days old – mahesh Feb 12 '14 at 19:32
  • No worries, it will have to wait for two days before marking as accepted. In the meantime keep an eye out for other answers that may be better solutions. – Kelly S. French Feb 12 '14 at 20:23
  • 1
    @mahesh I would imagine you could. – Vivin Paliath Feb 12 '14 at 20:42

2 Answers2

0

You should use the Java File class.

Ken
  • 654
  • 8
  • 18
0

This can be achieved by using

either http://jcifs.samba.org/

OR VFS

Read remote file in java which needs username and password

Community
  • 1
  • 1
mahesh
  • 1,523
  • 4
  • 23
  • 39
  • This is an incomplete answer. Doesn't address the problem of how to check the file permissions – Pubudu Jul 26 '17 at 18:39