Re: Remote directory <-> local directory comparison


Subject: Re: Remote directory <-> local directory comparison
From: Brian ThunderEagle (furbs@mail.swjedi.net)
Date: Wed Dec 18 2002 - 01:54:11 AKST


     This code will return the size of a file, but it has limitations. It would
require some more testing than I have done to be sure of it's capabilities.
There are 2 examples that work, one using and html file and one using a jpg
file. I know that this code doesn't work for returning php file sizes.

 
#!/usr/bin/perl
use LWP::Simple;
my @heads = head 'http://www.swjedi.net/index.html';
print "$heads[1] bytes\n";

use LWP::Simple;
my @heads = head 'http://www.swjedi.net/_themes/neon/neobkgnd.jpg';
print "$heads[1] bytes\n";

     Brian ThunderEagle
      - http://www.swjedi.net
      - furbs@swjedi.net
      - bthundereagle@aidea.org

Quoting Brian ThunderEagle <furbs@mail.swjedi.net>:

> PERL:
>
> #!/usr/bin/perl
> $file="/var/log/messages";
> $size=(stat("".$file.""))[7];
> print "size of ".$file." is ".$size." bytes\n";
>
> or directly on the command line
>
> perl -e '$file="/var/log/messages"; $size=(stat("".$file.""))[7]; print "size
>
> of ".$file." is $size bytes\n"'
>
> This will get you the size of a file directly on the system. Getting the size
>
> of the file on a remote though I am not sure. I will have to look into
> that.
>
>
> Brian ThunderEagle
> - http://www.swjedi.net
> - furbs@swjedi.net
> - bthundereagle@aidea.org
>
>
>
>
>
> Quoting Tim Johnson <tim@johnsons-web.com>:
>
> >
> > * Arthur Corliss <arthur@corlissfamily.org> [021218 10:07]:
> > > On Tue, 17 Dec 2002, Tim Johnson wrote:
> > >
> > > >
> > > > Howdy:
> > > > Here's one for you perl programmers.
> > > >
> > > > 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.
> > > > 3)Possible (but not necessarily) run 'diff' against them
> > > >
> > > > I program in rebol and python - (and can understand perl
> > > > enough to get me in trouble) I don't believe rebol can
> > > > do this reliably at all, and I'm not sure that python
> > > > can either, but will post those MLs too.
> > >
> > > You don't say what protocol you're using to access the remote machine.
> >
> > Howdy Arthur:
> >
> > FTP or http. Whatever gets the results. However, I've already
> > found my error in rebol code. So I'm now getting what I need
> > from rebol.
> >
> > In rebol, I used FTP. BTW: I've been told in the Python
> > mailing list that getting file sizes via FTP w/python is
> > unreliable. I do believe that both perl and rebol do
> > it fine... I just needed some tips.
> > - thanks Arthur -
> >
> > rebol example below:
> > >> probe info?
> >
> ftp://login_here:password_here@www.johnsons-web.com/cgi-bin/wmj/WmjSearch.r
> > connecting to: www.johnsons-web.com
> >
> > make object! [
> > size: 38546
> > date: 17-Dec-2002/22:29
> > type: 'file
> > ]
> >
> > Or capture the object and reference the 'size method...
> >
> > --
> > Tim Johnson <tim@johnsons-web.com>
> > http://www.alaska-internet-solutions.com
> > http://www.johnsons-web.com
> >
> > ---------
> > To unsubscribe, send email to <aklug-request@aklug.org>
> > with 'unsubscribe' in the message body.
> >
>
>
> -------------------------------------------------
> This mail sent through IMP: http://horde.org/imp/
>

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Wed Dec 18 2002 - 13:55:15 AKST