You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
4.5 KiB

import os
path = r'D:\bishe\data_set\sn_data\sn\baibu'
filelist = os.listdir(path)
# 开始文件名1000.jpg
count = 10000
for file in filelist:
Olddir = os.path.join(path, file)
if os.path.isdir(Olddir):
continue
filename = os.path.splitext(file)[0]
filetype = os.path.splitext(file)[1]
Newdir = os.path.join(path, str(count) + filetype)
os.rename(Olddir, Newdir)
count += 1
path = r'D:\bishe\data_set\sn_data\sn\baishao'
filelist = os.listdir(path)
# 开始文件名1000.jpg
count = 10000
for file in filelist:
Olddir = os.path.join(path, file)
if os.path.isdir(Olddir):
continue
filename = os.path.splitext(file)[0]
filetype = os.path.splitext(file)[1]
Newdir = os.path.join(path, str(count) + filetype)
os.rename(Olddir, Newdir)
count += 1
path = r'D:\bishe\data_set\sn_data\sn\gouqi'
filelist = os.listdir(path)
# 开始文件名1000.jpg
count = 10000
for file in filelist:
Olddir = os.path.join(path, file)
if os.path.isdir(Olddir):
continue
filename = os.path.splitext(file)[0]
filetype = os.path.splitext(file)[1]
Newdir = os.path.join(path, str(count) + filetype)
os.rename(Olddir, Newdir)
count += 1
path = r'D:\bishe\data_set\sn_data\sn\huangjing'
filelist = os.listdir(path)
# 开始文件名1000.jpg
count = 10000
for file in filelist:
Olddir = os.path.join(path, file)
if os.path.isdir(Olddir):
continue
filename = os.path.splitext(file)[0]
filetype = os.path.splitext(file)[1]
Newdir = os.path.join(path, str(count) + filetype)
os.rename(Olddir, Newdir)
count += 1
path = r'D:\bishe\data_set\sn_data\sn\jianghuang'
filelist = os.listdir(path)
# 开始文件名1000.jpg
count = 10000
for file in filelist:
Olddir = os.path.join(path, file)
if os.path.isdir(Olddir):
continue
filename = os.path.splitext(file)[0]
filetype = os.path.splitext(file)[1]
Newdir = os.path.join(path, str(count) + filetype)
os.rename(Olddir, Newdir)
count += 1
path = r'D:\bishe\data_set\sn_data\sn\lulutong'
filelist = os.listdir(path)
# 开始文件名1000.jpg
count = 10000
for file in filelist:
Olddir = os.path.join(path, file)
if os.path.isdir(Olddir):
continue
filename = os.path.splitext(file)[0]
filetype = os.path.splitext(file)[1]
Newdir = os.path.join(path, str(count) + filetype)
os.rename(Olddir, Newdir)
count += 1
path = r'D:\bishe\data_set\sn_data\sn\puhuang'
filelist = os.listdir(path)
# 开始文件名1000.jpg
count = 10000
for file in filelist:
Olddir = os.path.join(path, file)
if os.path.isdir(Olddir):
continue
filename = os.path.splitext(file)[0]
filetype = os.path.splitext(file)[1]
Newdir = os.path.join(path, str(count) + filetype)
os.rename(Olddir, Newdir)
count += 1
path = r'D:\bishe\data_set\sn_data\sn\shechuangzi'
filelist = os.listdir(path)
# 开始文件名1000.jpg
count = 10000
for file in filelist:
Olddir = os.path.join(path, file)
if os.path.isdir(Olddir):
continue
filename = os.path.splitext(file)[0]
filetype = os.path.splitext(file)[1]
Newdir = os.path.join(path, str(count) + filetype)
os.rename(Olddir, Newdir)
count += 1
path = r'D:\bishe\data_set\sn_data\sn\yimucao'
filelist = os.listdir(path)
# 开始文件名1000.jpg
count = 10000
for file in filelist:
Olddir = os.path.join(path, file)
if os.path.isdir(Olddir):
continue
filename = os.path.splitext(file)[0]
filetype = os.path.splitext(file)[1]
Newdir = os.path.join(path, str(count) + filetype)
os.rename(Olddir, Newdir)
count += 1
path = r'D:\bishe\data_set\sn_data\sn\yujin'
filelist = os.listdir(path)
# 开始文件名1000.jpg
count = 10000
for file in filelist:
Olddir = os.path.join(path, file)
if os.path.isdir(Olddir):
continue
filename = os.path.splitext(file)[0]
filetype = os.path.splitext(file)[1]
Newdir = os.path.join(path, str(count) + filetype)
os.rename(Olddir, Newdir)
count += 1
path = r'D:\bishe\data_set\sn_data\sn\zhiqiaopian'
filelist = os.listdir(path)
# 开始文件名1000.jpg
count = 10000
for file in filelist:
Olddir = os.path.join(path, file)
if os.path.isdir(Olddir):
continue
filename = os.path.splitext(file)[0]
filetype = os.path.splitext(file)[1]
Newdir = os.path.join(path, str(count) + filetype)
os.rename(Olddir, Newdir)
count += 1