I finally managed to achieve this & I thought may be this could help others to accomplish such needs. Well, as I've mentioned earlier I referred to this KB article and used below commands to achieve without any loss of DATA's
I couldn't copy the directory itself but I manage to copy all the contents inside it without loosing permission. So here's how
Firstly, I created a folder just to copy all the contents lies inside the source directry & I used
xcopy to copy all files and folders by retaining its permissions.
xcopy c:\source_folder_name e:\destination_folder_name /O /X /E /H /K
- /E - Copies folders and subfolders, including empty ones.
- /H - Copies hidden and system files also.
- /K - Copies attributes. Typically, Xcopy resets read-only attributes.
- /O - Copies file ownership and ACL information.
- /X - Copies file audit settings (implies /O).
This will do without any further questions. And once done I noticed there was a file count difference between the copied and origin. Therefore, I used
robocopy to make sure all files are in place by creating a log file while mirroring.
Assuming your command prompt path is C:/..
robocopy c:\source_folder_name e:\destination_folder_name /MIR /LOG:log.txt
- /MIR - Mirror files and copy/modify/delete between source and destination.
- /LOG - Creates a log file of the process
Note: log file will be created in location where the drive or the path which is shown on the command prompt. E.g.: if its C:/, then the log will be in there).
robocopy did its part, I once checked the properties to make sure both are tallying. Heavenly yes! it was tallying and I checked the log to see which file wasn't copied. As I suspected it was just thumbs.db & few of other files which was omitted.
P.S.: Be aware when you're using robocopy for mirroring as it may remove/modify source files by any chance it if couldn't tally with destination (very rare, but may happen). I've used it because the filed count on the new destination was lower than the origin. Also, I had a back copy of the source file just to avoid any DATA loss. Other than, both these commands will execute without causing any trouble at all.
Hope this helps!