randomdir: nicer filenames
This commit is contained in:
parent
c3d7015d9d
commit
3693327da9
1 changed files with 2 additions and 2 deletions
|
@ -39,11 +39,11 @@ def generate(spec):
|
||||||
|
|
||||||
picked = random.sample(found_files, int(spec['howmany']))
|
picked = random.sample(found_files, int(spec['howmany']))
|
||||||
|
|
||||||
# TODO: use specnick
|
|
||||||
nick = spec.get('nick', spec.eid)
|
nick = spec.get('nick', spec.eid)
|
||||||
for path in picked:
|
for path in picked:
|
||||||
tmp = mkstemp(suffix=os.path.splitext(path)[-1],
|
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])
|
os.close(tmp[0])
|
||||||
shutil.copy(path, tmp[1])
|
shutil.copy(path, tmp[1])
|
||||||
log.info("copying %s -> %s", path, os.path.basename(tmp[1]))
|
log.info("copying %s -> %s", path, os.path.basename(tmp[1]))
|
||||||
|
|
Loading…
Reference in a new issue