Suppose I have a folder under partition D that is D:\folder\link_folder which is a directory symbolic link whose target is E:\real_folder, i.e. it was created by:
mklink /d D:\folder\link_folder E:\real_folder Now I need to move D:\folder to F:\ by the Explorer UI like cut/paste. But I found that now there is a full copy of E:\real_folder under F:\folder\link_folder which is not a link anymore.
Is there a way to just create F:\folder\link_folder as a link to E:\real_folder during the folder move process? There is a lot of such links under D:\folder.
31 Answer
You can use robocopy to move folders that contain directory symbolic links by using the /move /SL and /e parameters. Following your example, you could then use the command as follows:
robocopy D:\folder F:\folder /move /e /SL /move will move the target instead of copy.
/e will copy (move) all sub-directories including empty ones.
/SL will copy (move) the symbolic link instead of following it.
note: elevated command prompt is required for moving symbolic links in windows 10.
note: For symbolic links created using mklink /d.
References: Microsoft Docs robocopy contains syntax and details on robocopy, examples can be found at Technet robocopy examples. Related forum post on copying directory symlinks in Windows 7.
5