-
-
Save sompodsign/fdc0b168e3c4d2cfe225da31eba58a67 to your computer and use it in GitHub Desktop.
Script to convert pdf to epub.
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
import os | |
from time import sleep | |
path = os.getcwd() | |
files = os.listdir(path) | |
#install package | |
os.system('sudo apt install calibre -y && sudo apt update') | |
#remove espacos e insere _ | |
for file in files: | |
os.rename(os.path.join(path, file), os.path.join(path, file.replace(' ', '_'))) | |
for file in files: | |
if file.endswith('.pdf'): | |
f = file.split('.') | |
f = f[0] | |
os.system('ebook-convert {} {}.epub'.format(file, f)) | |
sleep(10) | |
print ('Finalizado.....') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment