Skip to content

Instantly share code, notes, and snippets.

@ikekou ikekou/main.py
Created Aug 12, 2014

Embed
What would you like to do?
ディレクトリにあるph_001.jpgっていうファイルを1.jpgにリネームする
# -*- coding: utf-8 -*-
import os
import sys
import os.path
dir = './'
files = os.listdir(dir)
for file in files:
print '--'
src=file
if(src[0]=='.'):
continue
if(src==__file__):
continue
dist=src.replace('ph_','')
name,ext=dist.split('.')\
dist2=str(int(name))+'.'+ext
print(dist2)
os.rename(src,dist2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.