I have a case where a FileServer migration was not successful because the user who did not have permission on all folders.
So I have two servers with the same folder structure, but as users have already worked on the folders I can’t copy EVERYTHING again, as it could take files that the user has already deleted, for example.
However, I noticed a pattern, folders not copied due to permission error were left empty in the destination.
So, I found it by searching the following powershell script, which lists all empty folders at destination:
(gci E:DepartmentsMarketing -r | ? {$_.PSIsContainer -eq $True}) | ?{$_.GetFileSystemInfos().Count -eq 0} | select FullName
What I have been doing is accessing folders, for example in E:DepartmentsMarketing and copying from oldservere$departmentsMarketing
But there are a LOT of folders to do manually.
Does anyone know a script to nest this with a foreach to get each folder and copy the data from the UNC path and copy it to the new one?