diff --git a/lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php b/lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php
index 67bcd423b68761d11de90fa63634ec0b669766be..fc261e4bc5abd3971674a21ecb5b53d5da8c7048 100644
--- a/lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php
+++ b/lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php
@@ -32,12 +32,18 @@ class ExcludeFoldersByPathFilterIterator extends \RecursiveFilterIterator {
 			$appFolders[$key] = rtrim($appFolder['path'], '/');
 		}
 
-		$this->excludedFolders = array_merge([
+		$excludedFolders = [
 			rtrim($root . '/data', '/'),
 			rtrim($root .'/themes', '/'),
 			rtrim($root.'/config', '/'),
 			rtrim($root.'/apps', '/'),
-		], $appFolders);
+		];
+		$customDataDir = \OC::$server->getConfig()->getSystemValue('datadirectory', '');
+		if($customDataDir !== '') {
+			$excludedFolders[] = rtrim($customDataDir, '/');
+		}
+
+		$this->excludedFolders = array_merge($excludedFolders, $appFolders);
 	}
 
 	/**