# -*- coding: utf-8 -*-
import os
import numpy as np
import cv2
list_path = r"F:\project\cls\yanshen\20201209/"
g = os.walk(list_path)
test_dataset = ['%s/%s' % (i[0], j) for i in g for j in i[-1]]
for index,filename in enumerate(test_dataset):
name = f'/{index:04d}.jpg'
dir_name=os.path.dirname(filename)
os.rename(filename,dir_name+name)
Filter images:
g = os.walk(list_path)
img_files = ['%s\\%s' % (i[0], j) for i in g if i[0].endswith('JPEGImages') for j in i[-1] if
j.endswith('jpg')]
Read More:
- About OSS file download and rename
- Batch modification of file names on MAC Linux rename command line
- Java file rename failure
- [Vue] install vuex, error: eperm: operation not permitted, rename
- Samba mount directory file rename strange failure
- Windchill: object rename record
- npm ERR Error: EPERM:operation not permitted, rename
- Batch rename files on MAC (add prefix and suffix)
- NPM installation module encountered enoent: no such file or directory, rename error
- Fileexistserror: [winerror 183] cannot create a file when it already exists. File rename code attached
- Can’t find Python executable “D:\python3\python.exe”, you can set the PYTHON env variable.
- mysql ERROR 1025 (HY000): Error on rename of
- Solve the problem of unable to locate package python3.6 when upgrading from python3.5 to python3.6 in ubantu16.04
- yarn install gyp verb `which` failed python2 Error: not found: python2
- Python – [encoding] in Python os.system Solution to Chinese garbled code when calling CMD command
- Python – writing visual interface (Python + pycharm + pyqt)
- Python Basics – python3 installing pyhook and pywin32 Libraries
- The solution to the error of importing CSV from Python to Python
- KeyError: ‘/home/xxx/anaconda3/lib/python3.8/site-packages/parso/python/grammar38.txt‘
- Python module learning-Paramiko-Use python to throw an exception: Authentication failed.