I'm using 7-Zip 19.00 64-bit. I want to compress the files in a folder, but exclude sub-directories; disable recursive.
The command that I'm executing:
7z u -mx9 -r- -bd wwwroot.7z C:\inetpub\wwwroot\*.*
C:\inetpub\wwwroot\ will have sub-directories in it that are named after domains.
C:\inetpub\wwwroot\domain.com (directory)
C:\inetpub\wwwroot\domain.org (directory)
C:\inetpub\wwwroot\domain.net (directory)
C:\inetpub\wwwroot\images (directory)
C:\inetpub\wwwroot\javascript (directory)
C:\inetpub\wwwroot\index.html
C:\inetpub\wwwroot\robots.txt
C:\inetpub\wwwroot\favicon.ico
7-Zip is including sub-directories that match the wildcard; domain.com, domain.org, domain.net will be in wwwroot.7z. images and javascript will be excluded. index.html, robots.txt, and favicon.ico will be in wwwroot.7z as expected.
Because the folders for sites/domains will change over time, I can't hard-code the list of folders to exclude.
I've tried to use the following and none of them work as I want:
7z u -mx9 -r- -bd wwwroot.7z C:\inetpub\wwwroot\.
7z u -mx9 -r- -bd wwwroot.7z C:\inetpub\wwwroot\
I've looked in the documentation for ways to exclude by attribute but couldn't find it. I've looked at the -x option, but it only seems to apply to files.
The system that I'm running this on is Windows Server 2012 R2.
@Mofi: wwwroot.7z should only contain files, No sub-directories.
To accomplish this task with WinRAR, I'd use this command:
rar u -ma5 -m5 -ep1 C:\inetpub\wwwroot\wwwroot.rar C:\inetpub\wwwroot\*.*