Created
February 5, 2015 11:29
-
-
Save daniel-woods/af0876aa6a11e2da36c7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| #Executes from the folder the script is called from. | |
| #Recursively scans dirs for predetermined file extensions | |
| import os | |
| from subprocess import call | |
| from time import strftime | |
| for root, dirnames, filenames in os.walk(os.path.dirname(os.path.realpath(__file__))): | |
| for filename in filenames: | |
| if filename.endswith(('.epub','.pdf','.azw3','.lit')): | |
| src=root+'/'+filename | |
| dst=root+'/'+os.path.splitext(filename)[0]+'.mobi' | |
| if not os.path.isfile(dst): | |
| try: | |
| print(time.strftime("%X"),filenames.index(filename),'/',len(filenames)) | |
| w = subprocess.call(['ebook-convert', src, | |
| dst]) | |
| except Exception as err: | |
| print(err) | |
| #End of File. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment