import os, shutil
path = 'G:\\36mh\\小姐姐'
copy_to = 'G:\\one'
lis_dir = os.listdir(path)
paths = [path + '\\' + i for i in lis_dir]
for i in paths:
for j in os.listdir(i):
# ''.join([s for s in a if s.isdigit()])
from_file_name = i + '\\' + j
to_file_name = i.split('\\').pop().split('.')[0] + '_' + ''.join([s for s in j if s.isdigit()]) + '.jpg'
print(copy_to + '\\' + to_file_name, from_file_name)
shutil.copy(from_file_name, copy_to + '\\' + to_file_name)
网友评论