Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

separate files, no parent directories

filevans
2011-02-08
2014-01-25
  • filevans
    filevans
    2011-02-08

    hello all

    i'm trying to compress multiple folders into separate archives, which contain some folders inside them too, but without saving the parent directory, is that possible? something like this:

    archive 1.7z  ---> no parent directory
    directory 1
    directory 2
    file 1
    file 2

    archive 2.7z  ---> no parent directory
    directory 1
    directory 2
    file 1
    file 2

    i havent even been able to do it in winrar or winzip  either, its either recurse all folders, or none basically, won't let me miss out the parent directory

    thanks everyone for their time and help

     
  • I'm looking for the answer to this as well. All I have found so far is this post: http://www.marksanborn.net/linux/extract-without-first-directory/
    which seems to acknowledge that it is possible to set an archive to extract without a parent directory, but doesn't say how it is done. Could there be a parameter switch that you can use in 7zip when you create the archive file?

     
  • Shell
    Shell
    2014-01-25

    You may use NT command-line extensions to achieve that. Consider the following batch file:
    for %%a in (folder1,folder2,...,foldern) do (
    pushd %%a
    rem Now we're inside folder %%a, so it won't be added to the archive
    7z a switches absolute_path\%%~na.7z
    popd
    )