File size: 623 Bytes
7b615ae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#encoding=utf8
import os
import scripts.config as config

extension = '.jpg'

print('Starting processing...')
contador = 0
paths = [os.path.join(config.images, nome) for nome in os.listdir(config.images)]
files = [arq for arq in paths if os.path.isfile(arq)]
jpgs = [arq for arq in files if arq.lower().endswith(extension)]
for img in jpgs:
    imagePath = str(img)
    
    oldName = imagePath.replace(config.images, '')
    print('\n   ' + oldName)
    
    newName = config.images + str(contador) + extension
    os.rename(imagePath, newName)
    contador = contador + 1

print('\n\nCompleted...')