diff --git a/sohstationviewer/controller/util.py b/sohstationviewer/controller/util.py
index 85c8203f7736126bd843d98012a0a82a9be40b2a..c309427c4710c30b8752252ef8840d183f9c9d2a 100644
--- a/sohstationviewer/controller/util.py
+++ b/sohstationviewer/controller/util.py
@@ -24,7 +24,6 @@ def validate_file(path2file: Union[str, Path], file_name: str):
     :param file_name: name of the file
     :return: True if pass checking, False if not.
     """
-
     if file_name.startswith('.'):
         # skip info file
         return False
@@ -49,6 +48,25 @@ def validate_dir(path: str):
         raise Exception(f"Skip info folder: {path}")
 
 
+def get_total_files(list_of_dir: Path) -> int:
+    """
+    Get total number of valid files in valid directories from the list_of_dir
+    :param list_of_dir:
+    :return total: total number of valid files
+    """
+    total = 0
+    for folder in list_of_dir:
+        for path, _, files in os.walk(folder):
+            try:
+                validate_dir(path)
+            except Exception:
+                continue
+            total += len([f for f in files
+                         if validate_file(Path(path).joinpath(f), f)])
+
+    return total
+
+
 @QtCore.Slot()
 def display_tracking_info(tracking_box: QTextBrowser, text: str,
                           type: LogType = LogType.INFO):