Keep subdir\ prefix when adding files using wildcards

  • 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 .\subdir*

    adds all files and subfolders from folder subdir to archive 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

    $ 7z a subdir\

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

    Creating archive

    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

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

    Processing archive:

    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 .\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:

    If you need to use mask, e.g. archive *.txt files, try like:
    7z a -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 .\subdir
    then "subdir" is not included in the archive
    but if you just (as you did) use
    7z a 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