• Victor@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 month ago

      Thank God they went with file name extensions so we didn’t have to preface every source .txt file with header content to instruct the editor about what kind of content it would have.

        • cron@feddit.org
          link
          fedilink
          arrow-up
          0
          ·
          1 month ago

          Because both ways are used. Microsoft relies on file names, linux on the first bytes of the file.

          • Consti@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            1 month ago

            Not quite correct. For html, that is to signal standard compliance, you can leave it away and the browser will still handle it. For the bash one, all (most) shell scripts use .sh, so you need to give a shebang to tell the loader which executable (sh, bash, zsh, csh, …) to use

            Also on Linux xdg does take file extensions into account, just executables do not

    • cron@feddit.org
      link
      fedilink
      arrow-up
      0
      ·
      1 month ago

      OP refers to the fact that you can rename some filetypes to .zip and unpack them.

      Notable examples microsoft office files (.docx) or android apps (.apk).

      Counterexample are media files (mp3, mp4, jpg).

      • mumblerfish@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        1 month ago

        OP refers to the fact that you can rename some filetypes to .zip and unpack them.

        So… you mean the zip program just rename them back? Why?

        • cron@feddit.org
          link
          fedilink
          arrow-up
          0
          ·
          1 month ago

          I think it makes sense from a programming view. When you have a document, you can add all the media files and pack them together as one archive. Then the program sets the filename to .docx so everyone knows that they need an office program to open that file.

          For the users, all you need to know is what program can open which files. If every document would be named .zip, you would have no idea if it was a spreadsheet or slides for your presentation.

          • mumblerfish@lemmy.world
            link
            fedilink
            arrow-up
            0
            ·
            1 month ago

            I got that from the other answers. I was just very confused why I’d have to rename them to “.zip”.

            I still don’t get why it is “most” files.

            • stoy@lemmy.zip
              link
              fedilink
              arrow-up
              0
              arrow-down
              1
              ·
              1 month ago

              You don’t have to rename them, doing so would just make windows default to using the builtin zip extractor.

              If you have 7-zip you can just right click the file you wan to explore and try to extract it.

    • stoy@lemmy.zip
      link
      fedilink
      arrow-up
      0
      arrow-down
      1
      ·
      1 month ago

      Take a .docx file, using 7-zip, exctract it.

      You will get an entire folder structure with several files inside the .docx file.

      What OP means is that several programs use a zip file as a container for all the stuff they need in a save file.

      The file extention is just a name for the OS to find the proper program to open the file.

  • fine_sandy_bottom@lemmy.federate.cc
    link
    fedilink
    arrow-up
    0
    ·
    1 month ago

    Not really. The “file types” you’re talking about are expected to contain whatever things in a very specific format.

    You’re really just saying “many file types use an efficient and common compression algorithm”. Which is correct, obvious, and to be expected.