diff --git a/buildingspy/development/error_dictionary.py b/buildingspy/development/error_dictionary.py
index 2304f63..4a3c8d3 100644
--- a/buildingspy/development/error_dictionary.py
+++ b/buildingspy/development/error_dictionary.py
@@ -138,6 +138,13 @@ class ErrorDictionary(object):
             'model_message': "\"inner Modelica.StateGraph.StateGraphRoot\" is missing in '{}'.\n",
             'summary_message': "Number of models with missing StateGraphRoot                 : {}\n"}
 
+        self._error_dict["mismatched displayUnits"] = {
+            'tool_message': "Mismatched displayUnit",
+            'counter': 0,
+            'buildingspy_var': "iMisDisUni",
+            'model_message': "\"Mismatched displayUnit in '{}'.\n",
+            'summary_message': "Number of models with mismatched displayUnit                 : {}\n"}
+
     def get_dictionary(self):
         """ Return the dictionary with all error data
         """
diff --git a/buildingspy/development/refactor.py b/buildingspy/development/refactor.py
index ba4d363..2c064b0 100644
--- a/buildingspy/development/refactor.py
+++ b/buildingspy/development/refactor.py
@@ -637,6 +637,10 @@ def move_class(source, target):
 
     """
     ##############################################################
+    # First, remove empty subdirectories
+    _remove_empty_folders(source.replace(".", os.path.sep),
+                          removeRoot=False)
+    ##############################################################
     # Check if it is a directory with a package.mo file
     if os.path.isdir(source.replace(".", os.path.sep)):
         _move_class_directory(source, target)
@@ -665,6 +669,26 @@ def move_class(source, target):
     _update_all_references(source, target)
 
 
+def _remove_empty_folders(path, removeRoot=True):
+    ''' Remove empty directories
+    '''
+    if not os.path.isdir(path):
+        return
+
+    # remove empty subfolders
+    files = os.listdir(path)
+    if len(files):
+        for f in files:
+            fullpath = os.path.join(path, f)
+            if os.path.isdir(fullpath):
+                _remove_empty_folders(fullpath)
+
+    # if folder empty, delete it
+    files = os.listdir(path)
+    if len(files) == 0 and removeRoot:
+        os.rmdir(path)
+
+
 def _update_all_references(source, target):
     """ Updates all references in `.mo` and `.mos` files.
 

add test for Mismatched displayUnit
Add a test for `Mismatched displayUnit` to the regression testing
diff --git a/buildingspy/tests/test_development_error_dictionary.py b/buildingspy/tests/test_development_error_dictionary.py
index 393e2cc..ee9d12b 100644
--- a/buildingspy/tests/test_development_error_dictionary.py
+++ b/buildingspy/tests/test_development_error_dictionary.py
@@ -39,7 +39,8 @@ class Test_development_error_dictionary(unittest.TestCase):
                              'type inconsistent definition equations',
                              'unspecified initial conditions',
                              'unused connector',
-                             'stateGraphRoot missing'])
+                             'stateGraphRoot missing',
+                             'mismatched displayUnits'])
 
         self.assertEqual(len(k), len(k_expected), "Wrong number of keys.")
         for i in range(len(k)):
@@ -63,7 +64,8 @@ class Test_development_error_dictionary(unittest.TestCase):
                              'Type inconsistent definition equation',
                              'Dymola has selected default initial condition',
                              'Warning: The following connector variables are not used in the model',
-                             "A \\\"stateGraphRoot\\\" component was automatically introduced."])
+                             "A \\\"stateGraphRoot\\\" component was automatically introduced.",
+                             "Mismatched displayUnit"])
 
         self.assertEqual(len(k), len(k_expected), "Wrong number of tool messages.")
         for i in range(len(k)):

pip install -e .
parse_log_pytest
pytest
pytidylib pytest
apt-get update apt-get install -y tidy
3.6
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
-e git+https://github.com/lbl-srg/BuildingsPy.git@ad2f3e7ffb0a01117e5f09ac498a87b5c02ca158#egg=buildingspy
certifi==2021.5.30
future==1.0.0
gitdb==4.0.9
GitPython==3.1.18
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
Jinja2==3.0.3
MarkupSafe==2.0.1
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytidylib==0.3.2
smmap==5.0.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: BuildingsPy
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib-metadata=4.8.1=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - future==1.0.0
      - gitdb==4.0.9
      - gitpython==3.1.18
      - jinja2==3.0.3
      - markupsafe==2.0.1
      - pytidylib==0.3.2
      - smmap==5.0.0
prefix: /opt/conda/envs/BuildingsPy

buildingspy/tests/test_development_error_dictionary.py::Test_development_error_dictionary::test_keys buildingspy/tests/test_development_error_dictionary.py::Test_development_error_dictionary::test_tool_messages
buildingspy/development/error_dictionary.py buildingspy/development/refactor.py
buildingspy/development/error_dictionary.py buildingspy/development/refactor.py