Created
March 18, 2010 16:29
-
-
Save scottjacksonx/336535 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I have this on my server so that I can find out the size of any remote file just by SSHing into my server and running this script. | |
import urllib2 | |
import sys | |
url = sys.argv[1] | |
usock = urllib2.urlopen(url) | |
size = usock.info().get('Content-Length') | |
if size is None: | |
size = 0 | |
size = float(size) / 1024.0 / 1024.0 # in bytes | |
print str(size) + " MBytes" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment