diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php
index 1eff02e60b5e22d4d560b4cdc831819c42315d30..9f3e530478d0009274a93f6b2c6f537b09e4d4a5 100644
--- a/apps/files/lib/Service/OwnershipTransferService.php
+++ b/apps/files/lib/Service/OwnershipTransferService.php
@@ -37,6 +37,7 @@ use OC\Files\Filesystem;
 use OC\Files\View;
 use OCA\Files\Exception\TransferOwnershipException;
 use OCP\Encryption\IManager as IEncryptionManager;
+use OCP\Files\Config\IUserMountCache;
 use OCP\Files\FileInfo;
 use OCP\Files\IHomeStorage;
 use OCP\Files\InvalidPathException;
@@ -65,12 +66,17 @@ class OwnershipTransferService {
 	/** @var IMountManager */
 	private $mountManager;
 
+	/** @var IUserMountCache */
+	private $userMountCache;
+
 	public function __construct(IEncryptionManager $manager,
 								IShareManager $shareManager,
-								IMountManager $mountManager) {
+								IMountManager $mountManager,
+								IUserMountCache $userMountCache) {
 		$this->encryptionManager = $manager;
 		$this->shareManager = $shareManager;
 		$this->mountManager = $mountManager;
+		$this->userMountCache = $userMountCache;
 	}
 
 	/**
@@ -151,7 +157,9 @@ class OwnershipTransferService {
 		// collect all the shares
 		$shares = $this->collectUsersShares(
 			$sourceUid,
-			$output
+			$output,
+			$view,
+			$sourcePath
 		);
 
 		// transfer the files
@@ -236,7 +244,9 @@ class OwnershipTransferService {
 	}
 
 	private function collectUsersShares(string $sourceUid,
-										OutputInterface $output): array {
+										OutputInterface $output,
+										View $view,
+										?string $path = null): array {
 		$output->writeln("Collecting all share information for files and folders of $sourceUid ...");
 
 		$shares = [];
@@ -249,6 +259,23 @@ class OwnershipTransferService {
 				if (empty($sharePage)) {
 					break;
 				}
+				if ($path !== null) {
+					$sharePage = array_filter($sharePage, function (IShare $share) use ($view, $path) {
+						try {
+							$relativePath = $view->getPath($share->getNodeId());
+							$singleFileTranfer = $view->is_file($path);
+							if ($singleFileTranfer) {
+								return Filesystem::normalizePath($relativePath) === Filesystem::normalizePath($path);
+							}
+
+							return mb_strpos(
+								Filesystem::normalizePath($relativePath . '/', false),
+								Filesystem::normalizePath($path . '/', false)) === 0;
+						} catch (\Exception $e) {
+							return false;
+						}
+					});
+				}
 				$shares = array_merge($shares, $sharePage);
 				$offset += 50;
 			}
@@ -309,6 +336,12 @@ class OwnershipTransferService {
 						$share->setSharedBy($destinationUid);
 					}
 
+
+					// trigger refetching of the node so that the new owner and mountpoint are taken into account
+					// otherwise the checks on the share update will fail due to the original node not being available in the new user scope
+					$this->userMountCache->clear();
+					$share->setNodeId($share->getNode()->getId());
+
 					$this->shareManager->updateShare($share);
 				}
 			} catch (\OCP\Files\NotFoundException $e) {
diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php
index 9cf3b43a431b0ff130d8bf3ca69fea7ce8e502b9..32bfd5a71f36020e2c48585b32919e2adafa2470 100644
--- a/lib/private/Files/Config/UserMountCache.php
+++ b/lib/private/Files/Config/UserMountCache.php
@@ -409,4 +409,9 @@ class UserMountCache implements IUserMountCache {
 		$result->closeCursor();
 		return $results;
 	}
+
+	public function clear(): void {
+		$this->cacheInfoCache = new CappedMemoryCache();
+		$this->mountsForUsers = new CappedMemoryCache();
+	}
 }
diff --git a/lib/public/Files/Config/IUserMountCache.php b/lib/public/Files/Config/IUserMountCache.php
index 9fca98dc8439c86b824d1d79ffc052d503bab37e..fde4898bd39ae0ed967545ee7ab4133fdf9ac0e9 100644
--- a/lib/public/Files/Config/IUserMountCache.php
+++ b/lib/public/Files/Config/IUserMountCache.php
@@ -117,4 +117,11 @@ interface IUserMountCache {
 	 * @since 13.0.0
 	 */
 	public function getUsedSpaceForUsers(array $users);
+
+	/**
+	 * Clear all entries from the in-memory cache
+	 *
+	 * @since 20.0.0
+	 */
+	public function clear(): void;
 }