- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: need a perl script to compare size of 2 files
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2004 03:41 AM
02-19-2004 03:41 AM
I need a perl script to compare size of two files ( same names )
on two different ftp server
and if NOT the same size send a mail to administrator.
kind regards
chris
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2004 04:26 AM
02-19-2004 04:26 AM
Re: need a perl script to compare size of 2 files
There may be something you need at Merijn's site http://www.hpux.ws/merijn
Or try a thread in HP-UX languages. Then A.Clay Stephenson will see it and post something up for you.
I'm working on a perl script right now, or I'd try and hack it for you. The Languages forum has more traffic than Linux so its more likely to get you an answer.
If you don't have a solution when I'm done with my script, I'll take a "hack" at it.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2004 04:29 AM
02-19-2004 04:29 AM
Solution#!/usr/bin/perl
use Net::FTP;
$ftp=Net::FTP->new("host1", Debug => 0);
$ftp->login("user","password");
$SIZE=$ftp->size($ARGV[0]);
$ftp->quit;
$ftp=Net::FTP->new("host2", Debug => 0);
$ftp->login("user","password");
$SIZE1=$ftp->size($ARGV[1]);
$ftp->quit;
if($SIZE1 != $SIZE){
`echo $ARGV[0] is not the same size as $ARGV[1]|mailx -s "Subject" email
`;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2004 04:31 AM
02-19-2004 04:31 AM
Re: need a perl script to compare size of 2 files
if script is called "ftptest.pl" then run as
"ftptest.pl file1 file2"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2004 06:20 AM
02-19-2004 06:20 AM
Re: need a perl script to compare size of 2 files
it helps a lot.
but ist it possible to put the name of this
file as a variable for example:
$file
to the script,
because it will be the same file on both
server ( the same name also ).
I mean the script will be started only with: ftptest.pl
this file will be transfered via ftp
at night from one ftp server to another.
only the size will change.
what I need next day in the morning
is it to control if the file was transfered
successfully or not.
kind regards
chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2004 07:39 AM
02-19-2004 07:39 AM
Re: need a perl script to compare size of 2 files
small variations to the theme:
#!/usr/bin/perl
use Net::FTP;
$file = "put your filename here";
$ftp=Net::FTP->new("host1", Debug => 0);
$ftp->login("user","password");
$SIZE=$ftp->size($file);
$ftp->quit;
$ftp=Net::FTP->new("host2", Debug => 0);
$ftp->login("user","password");
$SIZE1=$ftp->size($file);
$ftp->quit;
if($SIZE1 != $SIZE){
`echo $file is out of synch|mailx -s "Subject" email
`;
}
It should be obvious where to plug the filename :-)
Greetings, Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 10:49 AM
03-26-2004 10:49 AM
Re: need a perl script to compare size of 2 files
but this srcript wont run properly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 10:51 AM
03-26-2004 10:51 AM
Re: need a perl script to compare size of 2 files
Try changing the DEBUG=>'s to 1, instead of 0 to get more details, to see where it falls over.