View Single Post
Old 05-31-2023, 02:03 PM   #9
tomsem
Grand Sorcerer
tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.
 
Posts: 6,959
Karma: 27060153
Join Date: Apr 2009
Location: USA
Device: iPhone 15PM, Kindle Scribe, iPad mini 6, PocketBook InkPad Color 3
Quote:
Originally Posted by kovidgoyal View Post
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.
It's not Windows, but trivial to modify to take a path. Thanks.
tomsem is offline   Reply With Quote