Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 530441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:11:49+00:00 2026-05-13T09:11:49+00:00

Description I’m interested in learning if there is any way to control sort order

  • 0

Description

I’m interested in learning if there is any way to control sort order of files inside zip files using standard routines in PHP and/or Java.

I’m not primarily interested in using zip/unzip using shell_exec() or similar, but it can be of interest if it provides with an easy to read solution.

With sort order it’s safe to assume it means date/time if no sort order is available within the zip file. I’ve not read the specs so I wouldn’t know.

Example

Files

foo.txt
bar.txt
test.txt
newfile.txt

Let’s assume that each file contains the name of the file (foo.txt => foo.txt)

Problem

I want to attach a sort order to the files so that when unpacked using unzip the files end up in the right order. This is important why? Because i use unzip -p to pipe the content of the zip file.

The order in which the files are added to the archive should not matter.

Result

Intended result (for the sake of this example (using unzip -p))

test.txt
foo.txt
newfile.txt
bar.txt

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:11:49+00:00Added an answer on May 13, 2026 at 9:11 am

    You can use the command zipinfo (or unzip -Z) to show files in the archive. man zipinfo also have examples on how to sort the output, but it can also be sorted in PHP if you read in the files in an array and sort the array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The description of System.Collection.Specialized.HybridDictionary is this: Implements IDictionary by using a System.Collections.Specialized.ListDictionary while the
I found a good description on wikipedia with a few reference links, but there
Is there a description of the various errors that NSXMLParser can return? I'm aware
Description | A Java program to read a text file and print each of
The description of DTDs in the XML 1.1 specification is very terse, and it
After reading this description of late static binding (LSB) I see pretty clearly what
I've read the description of functionoids here . They look like a poor-man's version
I have a description field indexed in Lucene.This field contains a book's description. How
Does filling out HTML meta description/keyword tags matter for SEO?
After I messed up the description of my previous post on this I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.