-
Notifications
You must be signed in to change notification settings - Fork 1
/
change_filename.py
48 lines (38 loc) · 1.71 KB
/
change_filename.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import os
from glob import glob
from tqdm import tqdm
if __name__ == '__main__':
scales = ['X2', 'X3', 'X4']
for s in scales:
files = glob(os.path.join('datasets', 'DF2K', 'DF2K_train_LR_bicubic', s, '*.png'))
for f in tqdm(files):
new_f = f.replace(s.lower(), '')
os.rename(f, new_f)
files = glob(os.path.join('datasets', 'DF2K', 'DF2K_train_LR_unknown', s, '*.png'))
for f in tqdm(files):
new_f = f.replace(s.lower(), '')
os.rename(f, new_f)
files = glob(os.path.join('datasets', 'DIV2K', 'DIV2K_train_LR_bicubic', s, '*.png'))
for f in tqdm(files):
new_f = f.replace(s.lower(), '')
os.rename(f, new_f)
files = glob(os.path.join('datasets', 'DIV2K', 'DIV2K_train_LR_unknown', s, '*.png'))
for f in tqdm(files):
new_f = f.replace(s.lower(), '')
os.rename(f, new_f)
files = glob(os.path.join('datasets', 'DIV2K', 'DIV2K_valid_LR_bicubic', s, '*.png'))
for f in tqdm(files):
new_f = f.replace(s.lower(), '')
os.rename(f, new_f)
files = glob(os.path.join('datasets', 'DIV2K', 'DIV2K_valid_LR_unknown', s, '*.png'))
for f in tqdm(files):
new_f = f.replace(s.lower(), '')
os.rename(f, new_f)
files = glob(os.path.join('datasets', 'Flickr2K', 'Flickr2K_LR_bicubic', s, '*.png'))
for f in tqdm(files):
new_f = f.replace(s.lower(), '')
os.rename(f, new_f)
files = glob(os.path.join('datasets', 'Flickr2K', 'Flickr2K_LR_unknown', s, '*.png'))
for f in tqdm(files):
new_f = f.replace(s.lower(), '')
os.rename(f, new_f)