0

Windows 1803, 7z 18.05

Trying to archive and compress a folder structure with multiple NTFS junctions referencing parts of the said structure (i.e. no "outside" links) - any possibility to compress the structure without 7zip resolving the junctions, resulting in duplicates?

Preserving the junctions would be neat, archiving the junctions as empty folders would also be acceptable - but archive size has absolute priority.

Choosing tar or wim as format has options about NTFS symlinks, but doesn't seem to involve compression (only store is presented as compression level) - I'd have to compress afterwards, which seems an unnecessary intermediate step.

I could delete the junctions before archiving, but I'd rather not to, if possible.

  • The 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. – AFH Oct 26 '18 at 14:46
  • @AFH these parameters seem to apply for wim and tar formats only – kamikatze13 Oct 26 '18 at 14:53
1

I would suggest to go in two steps :

  1. Generate a list of all the junctions in the folder
  2. Create a 7Zip archive from the folder while excluding the files in the list.

For the first step, you may use the following command in a Command Prompt :

dir /AL /S /B your-folder > exclude.txt

Where :

  • /A displays all files with a specific attribute, and L specifies reparse points (symlinks and directory junctions)
  • /S makes the command recursive
  • /B specifies the bare format of only file names.

When zipping the folder use the -x (Exclude filenames) switch :

7z a archive.7z folder\ -xr@exclude.txt

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.