Menu

/-zip ignores folders with special characters in it, need immediate fix!

John Smith
2020-01-19
2020-02-07
  • John Smith

    John Smith - 2020-01-19

    On the latest version of Windows 10, 7-zip is having issues with archiving folders and files with special characters in the name. For example, it will ignore a folder or file called "google.com" or "Trick |Treat" or "1/4" and so on.

    You can replicate this issue by using this Powershell script

    $7z = "C:\Program Files\7-Zip\7z.exe"
    
    Get-ChildItem -Path $PSScriptRoot -Directory | ForEach-Object {
        & "$7z" a -mx=9 $PSScriptRoot\$($_.Name) "$($_.FullName)\*"
    }
    
     
  • Hurry

    Hurry - 2020-01-20

    I do not think this is an issue within 7zip. Your script does not work properly.
    Maybe you have to put -LiteralPath into it, so that you get the full filename+path.
    Example:

    dir *.7z | ForEach-Object {
        $name = $_.Name
        $fullName = $_.FullName
        Write-Host "Starte: " $name " ..."
        &'C:\Program Files\7-Zip\7z.exe' x $name
        Write-Host $p
        if($LastExitCode -eq 0) {
            Write-Host "Fehlerfrei => loesche: " $fullName
            Remove-Item -LiteralPath $fullName
        } else {
            Write-Host "ACHTUNG: Fehler" $name " => beenden"
            exit(-1)
        }
    }
    
     

    Last edit: Hurry 2020-01-20
  • John Smith

    John Smith - 2020-01-21

    That did not work for me. What Powershell version are you using? https://i.imgur.com/TCrQBsS.png

     
  • Hurry

    Hurry - 2020-01-22

    Same as you (Windows 10 with latest updates), Powershell Build 18362.

     
  • John Smith

    John Smith - 2020-01-22

    Does your script work for you though? It doesn't do anything at all. No error, no execution.

     
  • Hurry

    Hurry - 2020-01-23

    Yes, it works:

     
  • Hurry

    Hurry - 2020-01-23

    Maybe your application path to 7z.exe differs from mine ? (C:\Program Files\7-Zip\7z.exe)
    Or there are no .7z - files in your folder?

     
  • John Smith

    John Smith - 2020-01-23

    The path is the same, but it doesn't work for me. Tried it on a fresh install of Windows 10 and it didn't work there either.

     
  • John Smith

    John Smith - 2020-01-24

    It's the same path. Why is it working for you but not for me?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.