File size: 623 Bytes
ef6a8c6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import os, os.path as osp, sys, shutil, argparse, re, glob, time, argparse, pdb
def rename(dir):
for root, dirs, files in os.walk(dir):
pdb.set_trace()
for file in files:
if file.endswith('.npy'):
new_name = file.split('_')[-1]
new_name = osp.join(root, new_name)
old_name = os.path.join(root, file)
os.rename(old_name, new_name)
print('Renamed {} to {}'.format(old_name, new_name))
if __name__ == '__main__':
dir = '/home/zjp/DeepDynamicFashion/REC-MV/data/yanzhi_a/parsing'
rename(dir) |