View Single Post
Old 05-30-2023, 11:50 PM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,414
Karma: 27757236
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Since the kindle just appears as a a disk it should be trivial to write a script that scans and deletes all empty folders on it. In fact here is one:

Code:
import os, sys, contextlib

def rmdir(x):
  with suppress(OSError):
     os.rmdir(x)

for (dirpath, dirnames, filenames) is os.walk(sys.argv[1]):
   for x in dirnames:
      rmdir(os.path.join(dirpath, x))
save it as clean.py and run it as

calibre-debug clean.py E:/

replace E:/ with the drive your kindle is mounted as.
kovidgoyal is offline   Reply With Quote