Mar 5, 2001 #1 Guest_imported New member Joined Jan 1, 1970 Messages 0 How do I get the file size from http://www.abc.com/file.txt?
Mar 6, 2001 #2 goBoating Programmer Joined Feb 8, 2000 Messages 1,606 Location US This works sometimes. Not all servers deliver the doc length as part of their header. Maybe, the servers you are dealing with will. Code: #!/usr/local/bin/perl use LWP::Simple; $url = '[URL unfurl="true"]http://www.someserver.com';[/URL] ($content_type,$doc_length,$modified,$expires,$server) = head($url); print "For $url, doc length is $doc_length.\n"; An alternative might be to retreive the page and look at it..... this takes a little longer, but, may do the trick. Code: #!/usr/local/bin/perl use LWP::Simple; $url = '[URL unfurl="true"]http://www.someserver.com';[/URL] getstore($url,"junk.html"); $size = (stat('junk.html'))[7]; print "size - $size\n"; unlink './junk.html'; HTH keep the rudder amid ship and beware the odd typo Upvote 0 Downvote
This works sometimes. Not all servers deliver the doc length as part of their header. Maybe, the servers you are dealing with will. Code: #!/usr/local/bin/perl use LWP::Simple; $url = '[URL unfurl="true"]http://www.someserver.com';[/URL] ($content_type,$doc_length,$modified,$expires,$server) = head($url); print "For $url, doc length is $doc_length.\n"; An alternative might be to retreive the page and look at it..... this takes a little longer, but, may do the trick. Code: #!/usr/local/bin/perl use LWP::Simple; $url = '[URL unfurl="true"]http://www.someserver.com';[/URL] getstore($url,"junk.html"); $size = (stat('junk.html'))[7]; print "size - $size\n"; unlink './junk.html'; HTH keep the rudder amid ship and beware the odd typo
Mar 9, 2001 Thread starter #3 Guest_imported New member Joined Jan 1, 1970 Messages 0 I just wanted to say thanks. This was a lot of help. right on Keep Boating Upvote 0 Downvote