import os, re
r = re.compile("([a-zA-Z]+)([0-9]+)")
for i in (os.walk(".")):
fn = i[0][2:].strip()
if len(fn) < 3 :
continue
fn2 = fn.upper()
fn3 = r.match(fn2)
try:
if fn.find('-') > 0 and fn3.group(1).isupper() :
print('In if %s' % fn)
continue
print("A=%s" % ( fn3.group(1)))
print("B=%s" % ( fn3.group(2)))
print("mv %s %s-%s" % (fn, fn3.group(1), fn3.group(2)))
except Exception as e:
print('exception: %s' % e)
print('In except %s' % fn)
if fn[1].islower():
print("mv %s %s" % (fn, fn.upper() ))
import os, re
r = re.compile("([a-zA-Z]+)([0-9]+)")
for i in (os.walk(".")):
fn = i[0][2:].strip()
if len(fn) < 3 :
continue
if fn.find('-') > 0 :
continue
fn2 = fn.upper()
fn3 = r.match(fn2)
try:
print("mv %s %s-%s" % (fn, fn3.group(1), fn3.group(2)))
except:
print(fn)
留言列表