> user1 has /folder1/folder2/folder3 and shares folder3 with user2. For user2 this will look like /Shared/folder3 and that's also the path we will receive here, for example if user2 uploads a file to the shared folder. dirname() from $path would return Shared but we want to iterate over /folder1/folder2/folder3 to update the original path. That's why we need to iterate over the internalPath which is the correct /folder1/folder2/folder3

Internal path won't be `/folder1/folder2/folder3` though for a shared file, it would be `folder3` because it's relative to the shared storage