diff --git a/src/calibre/ebooks/html/input.py b/src/calibre/ebooks/html/input.py
index 326afc00c0..413db1cc0b 100644
--- a/src/calibre/ebooks/html/input.py
+++ b/src/calibre/ebooks/html/input.py
@@ -296,8 +296,8 @@ class HTMLInput(InputFormatPlugin):
return self._is_case_sensitive
if not path or not os.path.exists(path):
return islinux or isfreebsd
- self._is_case_sensitive = os.path.exists(path.lower()) \
- and os.path.exists(path.upper())
+ self._is_case_sensitive = not (os.path.exists(path.lower()) \
+ and os.path.exists(path.upper()))
return self._is_case_sensitive
def create_oebbook(self, htmlpath, basedir, opts, log, mi):