Reputation: 121
I am on windows 10, and I'm struggling to exclude a directory from archive using the 7z CLI
Archive directory: D:/ zip file: C:/users/hamster/desktop/archive.zip exclude folder: D:/movies
Command:
C:\Program Files\7-Zip\7z.exe a -mhe -p{password} c:/users/hamster/desktop/archive.zip D:/ -x!D:/movies
7z still archives the movies directory. Any help is appreciated.
Upvotes: 5
Views: 7708
Reputation: 121
I found that the -x flag only works with relative paths by default. I included the -spf2 flag to allow full paths. I also added the * wildcard to capture all files and folders within the directory.
So the new command is as follow:
C:\Program Files\7-Zip\7z.exe a -mhe -p{password} -spf2 c:/users/hamster/desktop/archive.zip D:/ -x!D:/movies/*
Upvotes: 4