Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read a file from a different machine

Status
Not open for further replies.

pgk

Programmer
Jul 19, 2002
262
US
Hi,

Is there a way to read a text file that exists on a remote machine (w/o using ftp)? I tried using File() and gave the entire path as parameter. But the file could not be accessed.

File l_file = new File("/home/gpa/test.txt");

My current location is /home/dcassi/testapp on a different machine.

l_file.exists() returned false.

Thanks in advance.
Ganesh
 
Do you mean a really remote machine (ie the only contact is via TCP/IP sockets) or do you mean access a file on a mounted drive ?

I expect you mean the latter (ie non-remote machine) - so I guess the file does not exist.

What does "ls -ltr /home/gpa/test.txt" give you ?

--------------------------------------------------
Free Database Connection Pooling Software
 
Hi,

The ls returned nothing

Thanks.
Ganesh
 
In that case the file does not exist, so your call "l_file.exists()" would return false ... which is correct.



--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top