diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php
index a8a1b9bd1d64316162df734bb875e72f3e9da937..fa979c2006aeba49604d92a616294db5ed116088 100644
--- a/apps/files/lib/Service/OwnershipTransferService.php
+++ b/apps/files/lib/Service/OwnershipTransferService.php
@@ -247,7 +247,7 @@ class OwnershipTransferService {
 	private function collectUsersShares(string $sourceUid,
 										OutputInterface $output,
 										View $view,
-										?string $path = null): array {
+										string $path): array {
 		$output->writeln("Collecting all share information for files and folders of $sourceUid ...");
 
 		$shares = [];
@@ -260,7 +260,7 @@ class OwnershipTransferService {
 				if (empty($sharePage)) {
 					break;
 				}
-				if ($path !== null) {
+				if ($path !== "$sourceUid/files") {
 					$sharePage = array_filter($sharePage, function (IShare $share) use ($view, $path) {
 						try {
 							$relativePath = $view->getPath($share->getNodeId());