Keep subdir\ prefix when adding files using wildcards

Help
djm99
2013-02-04
2013-02-04
  • djm99

    djm99 - 2013-02-04

    I want to be able to keep the subdir\ prefix even if I use wildcards.
    (I dont see why they should be coupled).
    In the example below...Id like the filenames in the archive to -contain- subdir\ prefix.
    Is there a way to achieve this?
    If not, is it possible to make this a feature request please.

    Thanks in Advance.


    According to the documentation for "(a (Add) command)"
    .....................................................

    7z a archive2.zip .\subdir*

    adds all files and subfolders from folder subdir to archive archive2.zip. The filenames in archive will -not- contain subdir\ prefix.

     
  • fernando

    fernando - 2013-02-04

    Use wildcard if you need, in your example it is not.

    Is this what to desire:

    $ dir/s/b
    Z:\subdir
    Z:\subdir\file1
    Z:\subdir\file2
    Z:\subdir\subdir12
    Z:\subdir\subdir11
    Z:\subdir\subdir12\file121
    Z:\subdir\subdir12\file122
    Z:\subdir\subdir11\file111
    Z:\subdir\subdir11\file112

    $ 7z a archive2.zip subdir\

    7-Zip 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
    Scanning

    Creating archive archive2.zip

    Compressing subdir\file1
    Compressing subdir\file2
    Compressing subdir\subdir11\file111
    Compressing subdir\subdir11\file112
    Compressing subdir\subdir12\file121
    Compressing subdir\subdir12\file122

    Everything is Ok

    $ 7z t archive2.zip

    7-Zip 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18

    Processing archive: archive2.zip

    Testing subdir
    Testing subdir\file1
    Testing subdir\file2
    Testing subdir\subdir11
    Testing subdir\subdir11\file111
    Testing subdir\subdir11\file112
    Testing subdir\subdir12
    Testing subdir\subdir12\file121
    Testing subdir\subdir12\file122

    Everything is Ok

    Folders: 3
    Files: 6
    Size: 0
    Compressed: 1340

    $

     
  • djm99

    djm99 - 2013-02-04

    Sorry, I should have written

    7z a archive2.zip .\subdir*

     
  • djm99

    djm99 - 2013-02-04

    I realise the web front end is stripping my

    there should be a backslash before the asterisk at the end

     
  • fernando

    fernando - 2013-02-04

    I receive your correct/intended code in email:
    \<dot>\<backslash>\<subdir>\<backslash><\asterisk>

    If you need to use mask, e.g. archive *.txt files, try like:
    7z a archive2.zip -r subdir\*.txt

    (attached is code01.txt, in case of forum bbcode strip/alter)

     
    Last edit: fernando 2013-02-04
  • djm99

    djm99 - 2013-02-04

    Thank you very much for your helpful reply.
    I see the difference between what you tried and I did is the leading ".\"
    When you use
    7z a archive2.zip .\subdir
    then "subdir" is not included in the archive
    but if you just (as you did) use
    7z a archive2.zip subdir

    then it is.
    Seems like an "undocumented feature" :-)
    Thanks very much again

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks