In my test my folder structure is as follows:
D:\Data\1.db
D:\Data\2.db
D:\Data\3.db
D:\Data\FolderA\1.db
D:\Data\FolderA\2.db
D:\Data\FolderA\3.db
This is a simple example to my complex real world situation. I'm using the include list to backup only the .db
files (and many many other file types), but I don't want ANY sub-directories zipped, but I may not know the sub-directories names.
So the question is, – how do I compress files using an include list while excluding all sub-directories when the name of the sub-directories is unknown?
I've tried the following from my D:\Data
folder with the results in brackets
7za a -t7z D:\Backups\data.zip -r- -ir@"D:\data\include.txt" :: (sub-dirs included)
I changed the -r-
from the line above to the below with results in brackets
-xr- [incorrect command line]
-xr-!* [nothing zipped]
-xr!* [nothing zipped]
Best Answer
Found the answer quoted below If you want to use 7-zip, the tricky part seems to be persuading it not to recurse; the documentation's indicated
-r-
switch appears to be non-functional, and the suggested workaround from the software's author is to exclude subdirectories with the wildcard expression-x!*/
on Linux, and-x!*\
on Windows.