randomdir: nicer filenames

This commit is contained in:
boyska 2017-08-08 13:56:10 +02:00
parent c3d7015d9d
commit 3693327da9

View file

@ -39,11 +39,11 @@ def generate(spec):
picked = random.sample(found_files, int(spec['howmany']))
# TODO: use specnick
nick = spec.get('nick', spec.eid)
for path in picked:
tmp = mkstemp(suffix=os.path.splitext(path)[-1],
prefix='randomdir-%s-' % shortname(path))
prefix='randomdir-%s-%s-' % (shortname(nick),
shortname(path)))
os.close(tmp[0])
shutil.copy(path, tmp[1])
log.info("copying %s -> %s", path, os.path.basename(tmp[1]))