Benutzer-Werkzeuge

Webseiten-Werkzeuge


powershell:unterordnerkomprimieren

Unterordner komprimieren

function Compress-Subfolders
{
    param
    (
        [Parameter(Mandatory = $true)][string] $InputFolder,
        [Parameter(Mandatory = $true)][string] $OutputFolder
    )
 
    $subfolders = Get-ChildItem $InputFolder | Where-Object { $_.PSIsContainer }
 
    ForEach ($s in $subfolders) 
    {
        $path = $s
        $path
        Set-Location $path.FullName
        $fullpath = $path.FullName
        $pathName = $path.BaseName
 
        #Get all items 
        $items = Get-ChildItem -Recurse
 
        $zipname = $path.name + ".zip"
        $zippath = $outputfolder + $zipname
        Compress-Archive -Path $items -DestinationPath $zippath
    }
}

powershell/unterordnerkomprimieren.txt · Zuletzt geändert: 2017/05/02 10:06 von ronny

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki