Menu

Includes don't work

Help
johny why
2021-09-22
2021-09-26
  • johny why

    johny why - 2021-09-22

    I want to have two includes.

    The following commands zip ALL files in the source dir -- not limited to xlsm files.

    7z a -mx1 -r -tzip -ir!*.xlsm "C:\Data\Updated\Target.zip" "C:\Data\Target"
    
    7z a -tzip -mx1 -r "C:\Data\Updated\Target.zip" "C:\Data\Target\" *.xlsm
    

    The following 2-include switch fails -- all types are zipped.

    7z a -mx1 -r -tzip -i!"*.xlsm" -i!"*.xlsb" "C:\Data\Updated\Target.zip" "C:\Data\Target"
    

    i had to do it this way:

    7z a -tzip -mx1 -r "C:\Data\Updated\Target.zip" "C:\Data\Target\*.xlsm" "C:\Data\Target\*.xlsb"
    

    The top-level folder is lost, however.

     

    Last edit: johny why 2021-09-23
  • Igor Pavlov

    Igor Pavlov - 2021-09-23

    It's simpler to do with cd command:

    cd /D C:\Data\
    ... -r Target\*.xlsm
    
     
  • johny why

    johny why - 2021-09-23

    hi there

    i don't understand. Change to the parent directory of the source and target? Execute 7z twice? Why don't you show path to the zip?

    cd /D C:\Data
    7z a -tzip -mx1 -r "C:\Data\Updated\Target.zip" "Target\*.xlsb"
    7z a -tzip -mx1 -r "C:\Data\Updated\Target.zip" "Target\*.xlsm"
    

    Does the include switch work in some way?

    thx

     

    Last edit: johny why 2021-09-23
  • Igor Pavlov

    Igor Pavlov - 2021-09-23
    "Target\*.xlsb"  "Target\*.xlsm"
    
     

    Last edit: Igor Pavlov 2021-09-23
  • johny why

    johny why - 2021-09-26

    Yes, as i showed above -- include both paths, at least the parent folder. i used absolute paths, and you used relative.

    It seems this method excludes the parent folder from the archive. You only get everything under Target.
    Correct?

    The same command with one single path or pattern will include the parent folder. The same command with two paths will exclude the parent folder.

    This seems like an inconsistency.

     

    Last edit: johny why 2021-09-26

Log in to post a comment.