small corrections to def reorder_imgs

docker
Castro0o 5 years ago
parent 82a6404b40
commit 2b0e6654e0

@ -125,11 +125,10 @@ def listimgs(dir):
def reorder_imgs(dir, dry):
# does zero pad file numbers
# and returns correct order of files
lsimgs = listimgs(dir)
for img in lsimgs:
img_name, img_ext = os.path.splitext(img)
print(img)
# does file follow \d{1,}\.img_ext
numb_exp = re.compile(
r'(?P<name>.*?)(?P<num>\d+)(?P<ext>%s)'% re.escape(img_ext))
@ -151,6 +150,5 @@ def reorder_imgs(dir, dry):
print(f'Renaming: {img} >>>>> {new_img}')
if dry == False:
os.replace(src_img, dst_img)
lsimgs = listimgs(dir) # update list w/ renamed imgs
return listimgs(dir)
return listimgs(dir) # update list w/ renamed imgs

Loading…
Cancel
Save