Zip files expand with backslashes on Linux, no subdirectories












0














So, weirdly, I can unzip a file a friend made on windows. What it gives out is strange, and incorrect in a way I've not seen before.



<base directory stuff>
assetsChanges.txt
assetsDefaultConfig,txt


And so on. It's clearly meant to be a subdirectory, but they come out as files with a backslash in them.



They made it on Windows (using the Compress-Archive powerscript command), I attempted to extract it on Linux, using both the ark program from KDE, and archive-manager from GNOME.



What's going on here?










share|improve this question
























  • Yeah, but I want to know why this happens, rather than the fact that it happens on two more or less disparate tools
    – jaked122
    Dec 12 '18 at 5:17
















0














So, weirdly, I can unzip a file a friend made on windows. What it gives out is strange, and incorrect in a way I've not seen before.



<base directory stuff>
assetsChanges.txt
assetsDefaultConfig,txt


And so on. It's clearly meant to be a subdirectory, but they come out as files with a backslash in them.



They made it on Windows (using the Compress-Archive powerscript command), I attempted to extract it on Linux, using both the ark program from KDE, and archive-manager from GNOME.



What's going on here?










share|improve this question
























  • Yeah, but I want to know why this happens, rather than the fact that it happens on two more or less disparate tools
    – jaked122
    Dec 12 '18 at 5:17














0












0








0







So, weirdly, I can unzip a file a friend made on windows. What it gives out is strange, and incorrect in a way I've not seen before.



<base directory stuff>
assetsChanges.txt
assetsDefaultConfig,txt


And so on. It's clearly meant to be a subdirectory, but they come out as files with a backslash in them.



They made it on Windows (using the Compress-Archive powerscript command), I attempted to extract it on Linux, using both the ark program from KDE, and archive-manager from GNOME.



What's going on here?










share|improve this question















So, weirdly, I can unzip a file a friend made on windows. What it gives out is strange, and incorrect in a way I've not seen before.



<base directory stuff>
assetsChanges.txt
assetsDefaultConfig,txt


And so on. It's clearly meant to be a subdirectory, but they come out as files with a backslash in them.



They made it on Windows (using the Compress-Archive powerscript command), I attempted to extract it on Linux, using both the ark program from KDE, and archive-manager from GNOME.



What's going on here?







linux windows zip






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 12 '18 at 6:32









Kamil Maciorowski

24.8k155277




24.8k155277










asked Dec 12 '18 at 4:42









jaked122jaked122

1033




1033












  • Yeah, but I want to know why this happens, rather than the fact that it happens on two more or less disparate tools
    – jaked122
    Dec 12 '18 at 5:17


















  • Yeah, but I want to know why this happens, rather than the fact that it happens on two more or less disparate tools
    – jaked122
    Dec 12 '18 at 5:17
















Yeah, but I want to know why this happens, rather than the fact that it happens on two more or less disparate tools
– jaked122
Dec 12 '18 at 5:17




Yeah, but I want to know why this happens, rather than the fact that it happens on two more or less disparate tools
– jaked122
Dec 12 '18 at 5:17










1 Answer
1






active

oldest

votes


















1














It happens because some Windows tools apparently use backslashes () as separators where they should use forward slashes (/). Backslash in Unix can be a part of file or directory name.



.ZIP File Format Specification (version: 6.3.5 when I'm writing this, revised November 20, 2018) states:




4.4.17.1 The name of the file, with optional relative path.
The path stored MUST NOT contain a drive or
device letter, or a leading slash. All slashes
MUST be forward slashes / as opposed to
backwards slashes for compatibility with Amiga
and UNIX file systems etc. If input came from standard
input, there is no file name field.




This file is mentioned by Microsoft in a document Mitigation: ZipArchiveEntry.FullName Path Separator:




Starting with apps that target the .NET Framework 4.6.1, the path separator used in the ZipArchiveEntry.FullName property has changed from the backslash () used in previous versions of the .NET Framework to a forward slash (/). [...]



Impact



The change brings the .NET implementation into conformity with section 4.4.17.1 of the .ZIP File Format Specification and allows .ZIP archives to be decompressed on non-Windows systems.



Decompressing a zip file created by an app that targets a previous version of the .NET Framework on non-Windows operating systems such as the Macintosh fails to preserve the directory structure. For example, on the Macintosh, it creates a set of files whose filename concatenates the directory path, along with any backslash () characters, and the filename. As a result, the directory structure of decompressed files is not preserved.




Note the problem may exist if the archiver used some old version of .NET Framework or if it didn't use it at all but implemented its own (independent) approach to zip files.



One may experience the same problem with rar: Unrar creating files with backslashes in names instead of proper directory hierarchy.



You may find this question on Unix & Linux SE helpful: Convert a Windows-created ZIP to Linux (internal paths issue). My (somewhat experimental) approach is in this answer.






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1382839%2fzip-files-expand-with-backslashes-on-linux-no-subdirectories%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    It happens because some Windows tools apparently use backslashes () as separators where they should use forward slashes (/). Backslash in Unix can be a part of file or directory name.



    .ZIP File Format Specification (version: 6.3.5 when I'm writing this, revised November 20, 2018) states:




    4.4.17.1 The name of the file, with optional relative path.
    The path stored MUST NOT contain a drive or
    device letter, or a leading slash. All slashes
    MUST be forward slashes / as opposed to
    backwards slashes for compatibility with Amiga
    and UNIX file systems etc. If input came from standard
    input, there is no file name field.




    This file is mentioned by Microsoft in a document Mitigation: ZipArchiveEntry.FullName Path Separator:




    Starting with apps that target the .NET Framework 4.6.1, the path separator used in the ZipArchiveEntry.FullName property has changed from the backslash () used in previous versions of the .NET Framework to a forward slash (/). [...]



    Impact



    The change brings the .NET implementation into conformity with section 4.4.17.1 of the .ZIP File Format Specification and allows .ZIP archives to be decompressed on non-Windows systems.



    Decompressing a zip file created by an app that targets a previous version of the .NET Framework on non-Windows operating systems such as the Macintosh fails to preserve the directory structure. For example, on the Macintosh, it creates a set of files whose filename concatenates the directory path, along with any backslash () characters, and the filename. As a result, the directory structure of decompressed files is not preserved.




    Note the problem may exist if the archiver used some old version of .NET Framework or if it didn't use it at all but implemented its own (independent) approach to zip files.



    One may experience the same problem with rar: Unrar creating files with backslashes in names instead of proper directory hierarchy.



    You may find this question on Unix & Linux SE helpful: Convert a Windows-created ZIP to Linux (internal paths issue). My (somewhat experimental) approach is in this answer.






    share|improve this answer


























      1














      It happens because some Windows tools apparently use backslashes () as separators where they should use forward slashes (/). Backslash in Unix can be a part of file or directory name.



      .ZIP File Format Specification (version: 6.3.5 when I'm writing this, revised November 20, 2018) states:




      4.4.17.1 The name of the file, with optional relative path.
      The path stored MUST NOT contain a drive or
      device letter, or a leading slash. All slashes
      MUST be forward slashes / as opposed to
      backwards slashes for compatibility with Amiga
      and UNIX file systems etc. If input came from standard
      input, there is no file name field.




      This file is mentioned by Microsoft in a document Mitigation: ZipArchiveEntry.FullName Path Separator:




      Starting with apps that target the .NET Framework 4.6.1, the path separator used in the ZipArchiveEntry.FullName property has changed from the backslash () used in previous versions of the .NET Framework to a forward slash (/). [...]



      Impact



      The change brings the .NET implementation into conformity with section 4.4.17.1 of the .ZIP File Format Specification and allows .ZIP archives to be decompressed on non-Windows systems.



      Decompressing a zip file created by an app that targets a previous version of the .NET Framework on non-Windows operating systems such as the Macintosh fails to preserve the directory structure. For example, on the Macintosh, it creates a set of files whose filename concatenates the directory path, along with any backslash () characters, and the filename. As a result, the directory structure of decompressed files is not preserved.




      Note the problem may exist if the archiver used some old version of .NET Framework or if it didn't use it at all but implemented its own (independent) approach to zip files.



      One may experience the same problem with rar: Unrar creating files with backslashes in names instead of proper directory hierarchy.



      You may find this question on Unix & Linux SE helpful: Convert a Windows-created ZIP to Linux (internal paths issue). My (somewhat experimental) approach is in this answer.






      share|improve this answer
























        1












        1








        1






        It happens because some Windows tools apparently use backslashes () as separators where they should use forward slashes (/). Backslash in Unix can be a part of file or directory name.



        .ZIP File Format Specification (version: 6.3.5 when I'm writing this, revised November 20, 2018) states:




        4.4.17.1 The name of the file, with optional relative path.
        The path stored MUST NOT contain a drive or
        device letter, or a leading slash. All slashes
        MUST be forward slashes / as opposed to
        backwards slashes for compatibility with Amiga
        and UNIX file systems etc. If input came from standard
        input, there is no file name field.




        This file is mentioned by Microsoft in a document Mitigation: ZipArchiveEntry.FullName Path Separator:




        Starting with apps that target the .NET Framework 4.6.1, the path separator used in the ZipArchiveEntry.FullName property has changed from the backslash () used in previous versions of the .NET Framework to a forward slash (/). [...]



        Impact



        The change brings the .NET implementation into conformity with section 4.4.17.1 of the .ZIP File Format Specification and allows .ZIP archives to be decompressed on non-Windows systems.



        Decompressing a zip file created by an app that targets a previous version of the .NET Framework on non-Windows operating systems such as the Macintosh fails to preserve the directory structure. For example, on the Macintosh, it creates a set of files whose filename concatenates the directory path, along with any backslash () characters, and the filename. As a result, the directory structure of decompressed files is not preserved.




        Note the problem may exist if the archiver used some old version of .NET Framework or if it didn't use it at all but implemented its own (independent) approach to zip files.



        One may experience the same problem with rar: Unrar creating files with backslashes in names instead of proper directory hierarchy.



        You may find this question on Unix & Linux SE helpful: Convert a Windows-created ZIP to Linux (internal paths issue). My (somewhat experimental) approach is in this answer.






        share|improve this answer












        It happens because some Windows tools apparently use backslashes () as separators where they should use forward slashes (/). Backslash in Unix can be a part of file or directory name.



        .ZIP File Format Specification (version: 6.3.5 when I'm writing this, revised November 20, 2018) states:




        4.4.17.1 The name of the file, with optional relative path.
        The path stored MUST NOT contain a drive or
        device letter, or a leading slash. All slashes
        MUST be forward slashes / as opposed to
        backwards slashes for compatibility with Amiga
        and UNIX file systems etc. If input came from standard
        input, there is no file name field.




        This file is mentioned by Microsoft in a document Mitigation: ZipArchiveEntry.FullName Path Separator:




        Starting with apps that target the .NET Framework 4.6.1, the path separator used in the ZipArchiveEntry.FullName property has changed from the backslash () used in previous versions of the .NET Framework to a forward slash (/). [...]



        Impact



        The change brings the .NET implementation into conformity with section 4.4.17.1 of the .ZIP File Format Specification and allows .ZIP archives to be decompressed on non-Windows systems.



        Decompressing a zip file created by an app that targets a previous version of the .NET Framework on non-Windows operating systems such as the Macintosh fails to preserve the directory structure. For example, on the Macintosh, it creates a set of files whose filename concatenates the directory path, along with any backslash () characters, and the filename. As a result, the directory structure of decompressed files is not preserved.




        Note the problem may exist if the archiver used some old version of .NET Framework or if it didn't use it at all but implemented its own (independent) approach to zip files.



        One may experience the same problem with rar: Unrar creating files with backslashes in names instead of proper directory hierarchy.



        You may find this question on Unix & Linux SE helpful: Convert a Windows-created ZIP to Linux (internal paths issue). My (somewhat experimental) approach is in this answer.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 12 '18 at 6:29









        Kamil MaciorowskiKamil Maciorowski

        24.8k155277




        24.8k155277






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1382839%2fzip-files-expand-with-backslashes-on-linux-no-subdirectories%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Сан-Квентин

            8-я гвардейская общевойсковая армия

            Алькесар