Skip to content

Instantly share code, notes, and snippets.

@bergpb
Last active February 16, 2026 20:53
Show Gist options
  • Select an option

  • Save bergpb/fb15fbebf41190d2298339d484e589a0 to your computer and use it in GitHub Desktop.

Select an option

Save bergpb/fb15fbebf41190d2298339d484e589a0 to your computer and use it in GitHub Desktop.

Revisions

  1. bergpb revised this gist May 24, 2018. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions convert_pdf_epub.py
    Original file line number Diff line number Diff line change
    @@ -7,8 +7,6 @@
    #install package
    os.system('sudo apt install calibre -y && sudo apt update')

    print (file)

    #remove espacos e insere _
    for file in files:
    os.rename(os.path.join(path, file), os.path.join(path, file.replace(' ', '_')))
    @@ -17,7 +15,7 @@
    if file.endswith('.pdf'):
    f = file.split('.')
    f = f[0]
    os.system('ebook-convert {} {}.epub'.format(file, filename))
    os.system('ebook-convert {} {}.epub'.format(file, f))

    sleep(10)
    print ('Finalizado.....')
  2. bergpb created this gist May 24, 2018.
    23 changes: 23 additions & 0 deletions convert_pdf_epub.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    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')

    print (file)

    #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, filename))

    sleep(10)
    print ('Finalizado.....')