-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbatch_rename.py
More file actions
46 lines (35 loc) · 1.11 KB
/
batch_rename.py
File metadata and controls
46 lines (35 loc) · 1.11 KB
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
#!/usr/bin/env python
__author__ = 'blackvitriol'
"""
o 8
8 8
.oPYo. o o o8P 8oPYo. .oPYo. odYo.
8 8 8 8 8 8 8 8 8 8' `8
8 8 8 8 8 8 8 8 8 8 8
8YooP' `YooP8 8 8 8 `YooP' 8 8
8 ....::....8 ::..:..:::..:.....:..::..
8 :::::::ooP'.:::::::::::::::::::::::::
..:::::::...:::::::::::::::A7MD0V:::::::
::::Python Learning::::::::::::28:03:18:::
:::::::: Batch Rename :::::::::::::::::::::
Linux will sometimes make files without filetype in the name
this should fix it...
"""
print("Welcome to A7's Batch Renaming Tool...")
import glob,os
files = glob.glob('*')
print("Files found:")
print(files)
filetype = input("Enter your file format [example:'.jpg']:")
print("Now renaming all files with following format:", filetype)
for File in files:
newname = File + filetype
os.rename(File, newname)
'''
# Undo Rename if you mucked up
for File in files:
removal = len(filetype)
newname = File[:-removal]
os.rename(File, newname)
'''
print("Done renaming files...")