7zip issues

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
SIMMS7400
Posts: 546
Joined: 07 Jan 2016 07:47

7zip issues

#1 Post by SIMMS7400 » 12 Dec 2018 11:45

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!

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: 7zip issues

#2 Post by Squashman » 12 Dec 2018 12:05

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.

SIMMS7400
Posts: 546
Joined: 07 Jan 2016 07:47

Re: 7zip issues

#3 Post by SIMMS7400 » 12 Dec 2018 13:33

Thanks Squash.

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

Thank you!

Best,
C

Post Reply