Created
May 20, 2012 17:48
-
-
Save amazedkoumei/2758904 to your computer and use it in GitHub Desktop.
Bookscan FileName Converter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import os, re | |
path = os.getcwd() + "/" | |
p = re.compile('ipad3_(.+?)(\d+?p)_\d+?X?.pdf', re.IGNORECASE) | |
errBuff = [] | |
for name in os.listdir("./"): | |
if p.match(name): | |
m = p.match(name) | |
title = m.group(1).strip() | |
page_count = m.group(2).strip() | |
print title + " " + page_count + " ipad3.pdf" | |
os.rename(path + name, path + title + " " + page_count + " ipad3.pdf") | |
elif name.startswith("ipad3"): | |
errBuff.append(name) | |
if len(errBuff) >0: | |
print "NG!!!!!!" | |
for name in errBuff:print name | |
""" | |
USAGE: | |
1. download this script to [SCRIPT_DIR] | |
2. download book files from Bookscan to [BOOK_DIR] | |
3. cd [BOOK_DIR] | |
4. python [SCRIPT_DIR]/ipad.py | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment