Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from os import listdir, rename
- from os.path import isfile, join
- from random import choice
- from string import ascii_lowercase, digits
- mypath = 'c:\\1'
- l = 6
- onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f)) and f.upper().endswith('.JPG')]
- for f in onlyfiles:
- rnd = ''.join([choice(ascii_lowercase + digits) for _ in range(l)]+['.jpg'])
- rename(join(mypath, f),join(mypath, rnd))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement