#!/usr/bin/python import md5, sys, random, os if len(sys.argv) <= 1: print "Please specify number of files.\n" sys.exit(1) else: fmax = int(sys.argv[1]) spooldir = "/tmp/" subjects = ['Enlarge your rod now!', 'Spam', 'Total Spam', 'I am a spammy spammer.'] for i in range(fmax): hash = md5.new() hash.update(str(i)) name = hash.hexdigest() fname = spooldir + "%s-H" %name f = open(fname, 'w') f.write("Subject: %s\n" %random.choice(subjects)) f.write("From: president@whitehouse.gov\n") f.write("To: wattersmt@gmail.com\n") f.close() os.system("touch -t 201102101400 %s" %fname)