Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Comparing local and remote files

 [1/6] from: tim:johnsons-web at: 17-Dec-2002 21:27


Hi All: Given a list of files: I'd like to: 1)Confirm that a copy of any file in the list exists both on a remote directory and on my local machine. 2)Compare both copies to see if they are of the same size. Any ideas of where to start? Here's a track of a console session -
>> probe info? http://www.rebol.com/faq.html
connecting to: www.rebol.com make object! [ size: 79336 date: 12-Dec-2002/7:32:48 type: 'file ] :-)
>> exists? http://www.johnsons-web.com/cgi-bin/wmj/WmjSearch.r
connecting to: www.johnsons-web.com == true
>> probe info? http://www.johnsons-web.com/cgi-bin/wmj/WmjSearch.r
connecting to: www.johnsons-web.com make object! [ size: 0 date: none type: 'file ] ; <sigh/> -- Tim Johnson <[tim--johnsons-web--com]> http://www.alaska-internet-solutions.com http://www.johnsons-web.com

 [2/6] from: gchiu:compkarori at: 18-Dec-2002 20:56


On Tue, 17 Dec 2002 21:27:52 -0900 Tim Johnson <[tim--johnsons-web--com]> wrote:
>> probe info? >>>http://www.johnsons-web.com/cgi-bin/wmj/WmjSearch.r
<<quoted lines omitted: 4>>
> type: 'file >] ; <sigh/>
Try info? http://userid:[password--www--johnsons-web--com]/cgi-bin/wmj/WmjSearch.r -- Graham Chiu http://www.compkarori.com/cerebrus This hound hunts down spam!

 [3/6] from: gchiu:compkarori at: 18-Dec-2002 20:53


On Tue, 17 Dec 2002 21:27:52 -0900 Tim Johnson <[tim--johnsons-web--com]> wrote:
>Given a list of files: I'd like to: >1)Confirm that a copy of any file in the list exists > both on a remote directory and on my local machine. >2)Compare both copies to see if they are of the same >size.
Dunno if it helps, but I have a ftpdir script on my rebsite ( compkarori ) that uploads a directory to a website and does a file size comparison to make sure that you don't needlessly upload existing files. -- Graham Chiu http://www.compkarori.com/cerebrus

 [4/6] from: chalz:earthlink at: 18-Dec-2002 3:03


Mind, I'm far from an authority on this matter, but I think I might know what's up. I can sum it up right here:
>> exists? ftp://usr:[pwd--www--chalz--net]/www/cgi-bin/test.r
== true
>> exists? http://www.chalz.net/cgi-bin/test.r
connecting to: www.chalz.net == false
>>
The problem is it's a script. It gets evaluated, so while the URL does exist, you will never receive the file. What you receive is some HTML content, and it is variable. The file does not get read directly, only executed. You'll have to either execute your compare code from the remote host, and instead treat your local machine as remote, or settle for an FTP connection. For instance, if I try, with my web site:
>> exists? http://www.chalz.net/cgi-bin/roll
connecting to: www.chalz.net == true
>> probe info? http://www.chalz.net/cgi-bin/roll
connecting to: www.chalz.net make object! [ size: 0 date: none type: 'file ]
>> probe info? ftp://usr:[pwd--www--chalz--net]/www/cgi-bin/roll
make object! [ size: 2117 date: 26-Nov-2002/12:39 type: 'file ]
>>
Bingo. Since it's in cgi-bin, it won't return the contents of the file, only the evaluated result. I tried it with a test file, which printed "hello world". I set it up as readable and executable, exists? http://... sees it, but info? returns a dead object. I make it non-executable, and exists? http://... no longer sees it. Hope this helps :) --Charles

 [5/6] from: tim:johnsons-web at: 18-Dec-2002 7:34


* Graham Chiu <[gchiu--compkarori--co--nz]> [021217 23:13]:
> On Tue, 17 Dec 2002 21:27:52 -0900 > Tim Johnson <[tim--johnsons-web--com]> wrote:
<<quoted lines omitted: 10>>
> info? > http://userid:[password--www--johnsons-web--com]/cgi-bin/wmj/WmjSearch.r
Hey Graham: Thanks, I should have used ftp://userid:[password--www--johnsons-web--com]/cgi-bin/wmj/WmjSearch.r I believe that scheme reports reliably. Jogged my memory you did... good work. -tim-
> -- > Graham Chiu
<<quoted lines omitted: 4>>
> [rebol-request--rebol--com] with "unsubscribe" in the > subject, without the quotes.
-- Tim Johnson <[tim--johnsons-web--com]> http://www.alaska-internet-solutions.com http://www.johnsons-web.com

 [6/6] from: rebol-list2:seznam:cz at: 20-Dec-2002 16:19


Hello Tim, Wednesday, December 18, 2002, 7:27:52 AM, you wrote: TJ> Hi All: TJ> Given a list of files: I'd like to: TJ> 1)Confirm that a copy of any file in the list exists TJ> both on a remote directory and on my local machine. TJ> 2)Compare both copies to see if they are of the same size. TJ> Any ideas of where to start? TJ> Here's a track of a console session -
>>> probe info? http://www.rebol.com/faq.html
TJ> connecting to: www.rebol.com TJ> make object! [ TJ> size: 79336 TJ> date: 12-Dec-2002/7:32:48 TJ> type: 'file TJ> ] TJ> :-)
>>> exists? http://www.johnsons-web.com/cgi-bin/wmj/WmjSearch.r
TJ> connecting to: www.johnsons-web.com TJ> == true
>>> probe info? http://www.johnsons-web.com/cgi-bin/wmj/WmjSearch.r
TJ> connecting to: www.johnsons-web.com TJ> make object! [ TJ> size: 0 TJ> date: none TJ> type: 'file TJ> ] ; <sigh/> TJ> -- Info? is using the informations send by the server. If it's a script, the server don't know what size of the output will be, so it's 0 and the date is none (or the date you specify in your script).
>> o: open/direct/no-wait http://127.0.0.1/index.html >> probe o/locals
make object! [ list: [] headers: make object! [ Date: "Fri, 20 Dec 2002 11:51:08 GMT" Server: "Apache/1.3.9 (Win32) PHP/4.2.3" Last-Modified: "Wed, 13/Nov/2002/16:55:00/+GMT" Accept-Ranges: "bytes" Content-Encoding: none Content-Type: "text/html" Content-Length: "1414" Location: none Expires: none Referer: none Connection: "close" Authorization: none ETag: {"0-586-3dd283e4"} content: "" ] ]
>> o/date
== 13-Nov-2002/16:55
>> o/status
== file
>> close o >> o: open/direct/no-wait http://127.0.0.1/cgi-bin/probecgi.r >> probe o/locals
make object! [ list: [] headers: make object! [ Date: "Fri, 20 Dec 2002 11:54:32 GMT" Server: "Apache/1.3.9 (Win32) PHP/4.2.3" Last-Modified: none Accept-Ranges: none Content-Encoding: none Content-Type: "text/html" Content-Length: none Location: none Expires: none Referer: none Connection: "close" Authorization: none content: "" ] ]
>> close o
If someone don't know what is the 'list block in the port/locals -> it's used to store forwarded urls for the circular detection. =( Oliva David )=======================( [oliva--david--seznam--cz] )== =( Earth/Europe/Czech_Republic/Brno )============================= =( coords: [lat: 49.22 long: 16.67] )=============================

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted