Skip to content

Instantly share code, notes, and snippets.

@sota1235
Created July 31, 2014 09:17
Show Gist options
  • Save sota1235/a33bef0b97f667463ac8 to your computer and use it in GitHub Desktop.
Save sota1235/a33bef0b97f667463ac8 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
注意:sort済みのフォルダに使うとごっちゃになります
"""
import os
import sys
path = sys.argv[1]
file_list = os.listdir("./" + path)
count = 1
for f in file_list:
if f[0:1] == ".":
print f
continue
os.rename(path + "/" + f, path + "/" + str(count) + "." + f.split(".")[1])
count += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment