Siesmic_
Siesmic_

Reputation: 121

Is there a way to archiving using 7 zip CLI and exclude a particular folder using full paths?

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

Answers (1)

Siesmic_
Siesmic_

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

Related Questions