Page 1 of 1

7zip issues

Posted: 12 Dec 2018 11:45
by SIMMS7400
Hi Folks -

I'm banging my head against the wall on trying to exclude a certain directory from my archive process.

Code: Select all

SET "ASCENDDRIVE3=\\server.client.com\TM1_CDM_Data\Target"
SET "PDD_ZIP_PATH=%ASCENDDRIVE3%\Archive\PDD_TO_DATAHUB_OB_FILES_%DATETIME%.zip"

CALL "7z.exe" a -tzip "%PDD_ZIP_PATH%" "%ASCENDDRIVE3%" -x!%ASCENDDRIVE3%\Archive
In the folder Target, there is a subfolder called "Archive" that I want to exclude. I can't seem to get it to work. Can anyone see what I'm doing wrong?
Thanks!

Re: 7zip issues

Posted: 12 Dec 2018 12:05
by Squashman
Just reading the online help. It says that -X is to exclude file names. Does not say anything about folders.
I would say make a file list of all the files in that folder then use that file with the exclude option.

According to this SuperUser post the paths have to be relative. So you just use -xr!archive
https://superuser.com/questions/97342/7 ... rd-pattern

My Google Foo seems to be on today.

Re: 7zip issues

Posted: 12 Dec 2018 13:33
by SIMMS7400
Thanks Squash.

I ended up making an exclusion list and passing that in instead - works fine now!

Thank you!

Best,
C