Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? ZIP/7ZIP @listfile with folders

I went to update an old batch file and came across this issue. "zip" is too short of a search term and adding google to the search process didn't help either. This particular backup.btm iterates the files and folders so it can exclude folders like bin and obj from the output list, but include the other files and folders. It then uses that backup file list to create the archive.

So, given a file "%temp\baklist.txt" with lines like this:
base_file.txt
folder\folder_file.txt

Running the command: ZIP /A %output_archive @baklist.txt
results in an archive without any folder structure. Adding the /R param didn't help. All files are in the base of the archive and no folders are created within the archive. Since I need to exclude some files/folders, I cannot just use the wildcard with /R either, but need the list file.

If I use zip.exe or 7z.exe with the same list file, the resulting archive has a folder structure. How can I use the @file parameter to create a structured archive with the internal ZIP and 7ZIP commands? It doesn't seem this is possible with the current implementation. If not, please add to the suggestion list.
 
You have to add both file and directory. Or better yet, don't use zip, its file structure handling is crude and ineffective.
 

Similar threads

Back
Top