a guest Apr 16th, 2019 11 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- #!/usr/bin/env python3
- import os
- import random
- import string
- # With these settings, it took me 12 minutes to generate. YMMV.
- dirs = 10
- sublevels = 10
- files = 10
- filesize = 1024 # in kB
- root = '/var/tmp/dirtest'
- chars = string.printable
- def genData():
- for d in range(dirs):
- base = os.path.join(os.path.abspath(root), str(d))
- for s in range(sublevels):
- path = os.path.join(base, str(s))
- os.makedirs(path, exist_ok = True)
- for f in range(files):
- fpath = os.path.join(path, str(f))
- with open(fpath, 'a') as fh:
- fh.write(''.join(random.choice(chars) for i in range((filesize * 1024))))
RAW Paste Data