Exemplo n.º 1
0
				log.info("Bailing...")
				exit()
		LogUtil.f = codopen(options.output, "w", "utf-8")

if options.verbose:
	Globals.verbose = True
if options.quiet:
	LogUtil.quiet = True
if options.progress: 
	try: from progressbar import ProgressBar, Percentage, Bar, Timer, ETA
	except: 
		print "You need this: http://pypi.python.org/pypi/progressbar"
		exit(1)
	Globals.progress = True

Globals.consolesize = Console.getconsolewidth()
#end options
Globals.options = options

paths = buildpathlist(args)
			
for path in paths:
	if mode == "create":
		printsum(path, options.method)
	elif mode == "Continue":
		printsum(path, options.method, cont=True)
	elif mode == "check":
		if isfile(path) and (splitext(path)[1] == ".md5" or splitext(path)[1] == ".crc" or splitext(path)[1] == ".sfv"):
			checksums(path, options.method)
		else:
			checkpath(path, options.method)
Exemplo n.º 2
0
		options.maxsize = None
else: options.maxsize = None

if options.sortby != "name" or options.sortby != "size":
	log.warn("Invalid --sort-by value (%s). Using name." % repr(options.sortby))
	options.sortby = "name"

if options.quiet:
	LogUtil.quiet = True
	
if options.progress:
	try: from progressbar import AnimatedMarker, ProgressBar, Percentage, Bar, Timer, ETA
	except: 
		print "You need this: http://pypi.python.org/pypi/progressbar"
		exit(1)
	consolesize = Console.getconsolewidth()

#END OPTION CRAP

drives = {}
#populate drive info here
result = win32com.client.Dispatch("WbemScripting.SWbemLocator").ConnectServer(".", "root\cimv2").ExecQuery("Select * from Win32_LogicalDisk")
for drive in result: 
	if drive.Access == None:
		log.debug("Skipping drive: %s" % drive.Caption)
		continue
	if drive.Caption in drives:
		print "THIS SHOULDN'T HAPPEN"
		exit(1)
	drives[drive.Caption] = Drive(name=drive.VolumeName, letter=drive.Caption, type=drive.Description, fs=drive.FileSystem,
		serial=int(drive.VolumeSerialNumber, 16), size=int(drive.Size), free=int(drive.FreeSpace))