DL-Art-School/codes/scripts/rename.py

19 lines
413 B
Python
Raw Normal View History

2019-08-23 13:42:47 +00:00
import os
import glob
def main():
2020-04-22 06:38:53 +00:00
folder = 'datasets/div2k/DIV2K_valid_LR_bicubic/X4'
2019-08-23 13:42:47 +00:00
DIV2K(folder)
print('Finished.')
def DIV2K(path):
img_path_l = glob.glob(os.path.join(path, '*'))
for img_path in img_path_l:
new_path = img_path.replace('x2', '').replace('x3', '').replace('x4', '').replace('x8', '')
os.rename(img_path, new_path)
if __name__ == "__main__":
main()