7-zip commandline
7zip, command-line
Solution
In this 7-zip forum thread, in which many people express their desire for this feature, 7-zip's developer Igor points to the FAQ question titled "How can I store full path of file in archive?" to achieve a similar outcome.
In short:
- separate files by volume (one list for files on `C:\`, one for `D:\`, etc)
- then for each volume's list of files,
- chdir to the root directory of the appropriate volume (eg, `cd /d C:\`)
- create a file listing with paths relative to the volume's root directory (eg, `C:\Foo\Bar` becomes `Foo\Bar`)
- perform `7z a archive.7z @filelist` as before with this new file list
- when extracting with full paths, make sure to chdir to the appropriate volume's root directory first
Problem
I'm creating a backup utility that zips all the files listed in a text file. I am using MS ACCESS as my front-end and 7-Zip for compression. These are the commands I am using: ``` 7zG.exe a c:\Backup\backup.zip @c:\temp\tmpFileList.txt ``` All the files are compressed without their path. Is there a way to include the path for each file in the zip file? Then when `backup.zip` is extracted the files would be restored to their original folder structure. Thanks