diff --git a/climax/main/preprocess.py b/climax/main/preprocess.py
index 2d8b0c98250cf69b3fa4c658b8dec742b91c1615..20e60c5508786eed94dc84c1dbd0df46bb4b225e 100644
--- a/climax/main/preprocess.py
+++ b/climax/main/preprocess.py
@@ -82,7 +82,7 @@ if __name__ == '__main__':
 
         # get all the files matching the defined pattern in the source
         # directory
-        source = get_inventory(args.source, pattern, return_df=False)
+        source = sorted(get_inventory(args.source, pattern, return_df=False))
 
         # extract files of the specified variable
         LOGGER.info('Files matching "{}" for variable "{}":'.format(