Skip to content

Instantly share code, notes, and snippets.

@cloverrose
Created July 29, 2013 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cloverrose/6103278 to your computer and use it in GitHub Desktop.
Save cloverrose/6103278 to your computer and use it in GitHub Desktop.
JPEGminiで圧縮したファイルのファイル名を_mini.jpgから.jpgにリネームするスクリプト
# -*- coding:utf-8 -*-
"""
JPEG miniで小さくしたファイルの_mini.jpgを.jpgにリネームするスクリプト
"""
import os
from os.path import join
def main():
for root, dirs, files in os.walk('.'):
for name in (x for x in files if x.endswith('_mini.jpg')):
os.rename(join(root, name), join(root, name.replace('_mini.jpg', '.jpg')))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment