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

Close

A Separate Archive for Each Folder

2012-08-20
2012-12-07
  • Chaki_Black
    Chaki_Black
    2012-08-20

    Good day!
    Is it possible to add possibility to pack each folder to separate archive file when I'm creating an archive?
    Now I need add to archive each directory in series. It will be great I check several big directories and it will process several hours itself , and as result I will have several archive files.
    Thanks  :)

     
  • michaeljc70
    michaeljc70
    2012-08-20

    You can do this using Powershell.  If you don't use some scripting language, you cannot do it.  Here is what I use:

    $folds = Get-ChildItem -Path "c:\data\*" | Where-Object { $_.psiscontainer }
    foreach ($fold in $folds)
    {
    $sname = $fold.name
    $exec = "& 'C:\Program Files\7-Zip\7z.exe' u -mx5 -tzip -r  'c:\SkyDrive\backup\$sname.zip' '$fold\*.*'"
    $exec
    Invoke-Expression $exec

     
  • fernando
    fernando
    2012-08-20

    Is it possible to add possibility to pack each folder to separate archive file when I'm creating an archive?

    from root directory, try like…
    FOR /D %I IN (*) DO 7Z a "%I.7z" "%I"

     
  • Chaki_Black
    Chaki_Black
    2012-08-21

    You can do this using Powershell.  If you don't use some scripting language, you cannot do it.  Here is what I use:

    $folds = Get-ChildItem -Path "c:\data\*" | Where-Object { $_.psiscontainer }
    foreach ($fold in $folds)
    {
    $sname = $fold.name
    $exec = "& 'C:\Program Files\7-Zip\7z.exe' u -mx5 -tzip -r  'c:\SkyDrive\backup\$sname.zip' '$fold\*.*'"
    $exec
    Invoke-Expression $exec

    from root directory, try like…
    FOR /D %I IN (*) DO 7Z a "%I.7z" "%I"

    Of course it is possible. I wanted to add this option to graphical interface.
    OK, it's just if possible. This project is already very good and I use this software everywhere except WinRAR, so…
    Total Commander has this option - "each folder to separate archive", but it doesn't work always correctly and sometimes asks answers the questions before creating each archive. So this option isn't useful as can be. Needed to create archives silently.
    Thanks

     
  • Gadien
    Gadien
    2012-11-04

    Yes.. I'm not full on with the jargon that was just stated above, but I too would like to create seperate archives for the Multiple Folder's I have selected in explorer.

    I'm using Win-XP, and need layman's terms using a real senario of code and not "$sname = $fold.name"
    I am only familiar with a few Windows Command Line features.

     
  • dos386
    dos386
    2012-11-04

    Separate archive for each file or subdirectory.

    This had been discussed already 1'000'000'000'000 times. TotalCommander does have this feature.

     
  • michaeljc70
    michaeljc70
    2012-11-04

    TotalCommander is like file explorer, so that may work if you are looking to do this as a manual process.

    If you want to do it in an automated manor, you need to use a scripting tool.  If you don't know how to use a scripting tool, learn or you are out of luck. Two people have provided scripts and would probably answer questions, but aren't going to act as free technology consultants tailoring it to your needs.