Suppose you have a big folder structure with some directory symbolic links referring to other parts of the structure. You want to copy this whole arrangement such that the symbolic links in the new structure refer to the corresponding new folders, as opposed to blindly duplicating the link. As far as I can tell, there isn't a convenient way to do that.
So today, I wrote a fairly short but somewhat tricky script in PowerShell to do the job. It takes the source folder and the destination (which should already exist but be empty), recursively copying all the real files and folders first, then creating new symbolic links with adjusted target paths. This was made dramatically easier by PowerShell's ability to manage symlinks with the New-Item cmdlet and the Target property on file system objects.
No comments:
Post a Comment