-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathname
More file actions
executable file
·38 lines (31 loc) · 764 Bytes
/
Copy pathname
File metadata and controls
executable file
·38 lines (31 loc) · 764 Bytes
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
#!/usr/bin/python
"""
script to rename all files in a folder in increasing numbers
"""
import os
import sys
import argparse
import argcomplete
folder = '.'
parser = argparse.ArgumentParser()
parser.add_argument('-s',"--start",nargs='?',default =0,type = int)
argcomplete.autocomplete(parser)
args = parser.parse_args()
if args.start:
start = args.start
else:
start = 0
i = start
os.system('mkdir mvtemp')
for file in os.listdir(folder):
# print file + "to" + str(i) + os.path.splitext(file)[1]
if str(file) == 'mvtemp':
continue
pass
cmd = 'mv ' + file + " mvtemp/"+ str(i) + os.path.splitext(file)[1]
print cmd
# os.system(cmd)
i += 1;
pass
# os.system('mv mvtemp/* ./');
# os.system('rm -r mvtemp');