Differences

This shows you the differences between the selected revisions of the page.

2021-11-05 2021-11-05
make refresh optional (martin) Bug 2039 – Extension "ZIP and Upload" does not work with files in a drive root (martin)
Line 25: Line 25:
# @description  Packs the selected files to a ZIP archive and uploads it # @description  Packs the selected files to a ZIP archive and uploads it
# @flag        ApplyToDirectories # @flag        ApplyToDirectories
-# @version      8+# @version      9
# @homepage    ~~SELF~~ # @homepage    ~~SELF~~
# @require      WinSCP 5.16 # @require      WinSCP 5.16
Line 112: Line 112:
        {         {
            $parentPath = Split-Path -Parent (Resolve-Path $localPath)             $parentPath = Split-Path -Parent (Resolve-Path $localPath)
 +            if ($parentPath[-1] -ne "\")
 +            {
 +                $parentPath += "\";
 +            }
            if (Test-Path $localPath -PathType Leaf)             if (Test-Path $localPath -PathType Leaf)
Line 126: Line 130:
            foreach ($file in $files)             foreach ($file in $files)
            {             {
-                $entryName = $file.Replace(($parentPath + "\"), "")+                $entryName = $file.Replace($parentPath, "")
                Write-Host "Adding $entryName..."                 Write-Host "Adding $entryName..."
                [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile(                 [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile(

Last modified: by martin