🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #292

Re: How to determine whether a file exist or not in a remote host by using java?

#292
From: Scott
Date: Sat, 03 Apr 2004 16:37
42 lines
2380 bytes
Chris,

I think you'd have to have something running on the remote machine to answer
the question "Does /this file/ exist?".

Some ideas come to mind:

* If the remote machine has an ftp or http server running, and the server
has access to the directory, you could do something in java to query those
servers.  With http, for example, if the file's not there you'd get a 404
error header back.

* If you've got a webserver running asp, cold fusion, servlets, etc, you
could write something in one of those languages that was a bit more tailored
to your requirements.  does_file_exist.cfm?filename=this_file could return a
simple Yes or No back to you...no need to examine 404 headers, etc.

* Write a server in Java that accepted the remote request, looked for the
file and responded.  There is a lot of sample code out there showing how to
implement network servers in Java (often in the threads chapter of a java
tutorial).  Yours would just respond to the question "Does /this file/
exist?"

* Java's RMI (remote method invocation) might be suitable, but I'm way out
of my depth on how it works to say what to do.

Hope this helps.

Scott



"Chris" <wangguoqian@totyusoft.com> wrote in message
news:402b53b2$1@newsgroups.borland.com...
> Howdy,
>
> I want to confirm if  there is a file in a romote machine,
> How could I do using Java?
>
> TIA
> Regards.
>
Technical Details
Message-ID: <406ee8a7$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <402b53b2$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,160816a85b795761
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2004-04-03 08:40:22 PST
Reply-To: "Scott" <scotthpowell@yahoo.com>
From: "Scott" <scotthpowell@yahoo.com>
Newsgroups: borland.public.jbuilder.java.api
References: <402b53b2$1@newsgroups.borland.com>
Subject: Re: How to determine whether a file exist or not in a remote host by using java?
Date: Sat, 3 Apr 2004 11:37:48 -0500
Lines: 44
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 24.239.150.17
Message-ID: <406ee8a7$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1081010343 24.239.150.17 (3 Apr 2004 08:39:03 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail