'Robocopy - skip if the folder is same name else replace with target subfolder

I have a folder structure and have to do a robocopy where subfolders (version folder name) if they have same name , skip them and dont copy anything else if the subfolder name is not same then it will copy the content with target

--source
  --folder1
   --version.x
     --users
  --folder2
   --version.y
     --users
  --folder3
   --version.w
     --users

target folder condition before copy

--target
  --folder1
   --version.x
     --users
  --folder2
   --version.z
     --users

target folder condition after copy

--target
  --folder1
   --version.x (untocuhed)
     --users
  --folder2
   --version.z
     --users
    --version.y(untocuhed)
     --users
  --folder3
   --version.w
     --users

so folder1 with all the subfolders will not be copied ,

folder2 and subfolders will be copied with target folder content as version folder name is different ,

folder3 will be copied as its its not present in target



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source