it's obvious 7z (using 20.02 alpha) is not capable of preserving junctions. no solutions provided on the web work. creating a WIM archive thru 7z will seemingly preserve junctions, but unpacking the archive later on will break them, verify yourself using Russinovich's junction programme:
junction "D:\linux\shared\Work\www"
D:\linux\shared\Work\www: JUNCTION
Substitute Name: c:\program files\internet\proxydomo\html
Now, compressing folder "D:\linux\shared" to WIM (same applies to TAR) archive in 7z, then unpacking it, will break the junction, pointing it to:
D:\linux\shared\Work\www: JUNCTION
Print Name : D:\linux\shared\program files\internet\proxydomo\html
Substitute Name: D:\linux\shared\program files\internet\proxydomo\html
Solution? Use dism instead:
https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-image-management-command-line-options-s14
create an image:
dism /Capture-Image /ImageFile:D:\Copy\shared.wim /CaptureDir:D:\linux\shared /Name:shared /Compress:fast /Verify
mount the image into an empty directory and unmount it (and disrcard all changes - alternative would be /commit
that updates the image):
dism /mount-image /imagefile:shared.wim /index:1 /mountdir:D:\Copy\Fix\test
dism /unmount-image /mountdir:D:\Copy\Fix\test\ /discard
or extract the image content to an empty directory:
dism /Apply-Image /ImageFile:shared.wim /Index:1 /ApplyDir:D:\Copy\Fix\test /Verify
junctions are preserved properly. Relying on 3rd party programmes simply cannot achieve positive results. Logic dictates this. The Creator knows its own system best. What is true for God applies to everything and everybody else as well.
7z.exe
command-line interface has the options:-snh : store hard links as links
and-snl : store symbolic links as links
, but I can't see any options for these in the GUI version, either in Options or in the archive creation dialogue.wim
andtar
formats only