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 8324023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:54:24+00:00 2026-06-08T23:54:24+00:00

As a result of processing, some data files are written to disk. Count of

  • 0

As a result of processing, some data files are written to disk.

  • Count of files between 2 servers (MAC and Linux) match
  • File names are identical between systems
  • Files content is identical between systems, as measured by md5sum

Report is then computed based on content read from said files, using

    for (File f : contentDirectory.listFiles()) {
               // magic

.listFiles() javadoc says:

There is no guarantee that the name strings in the resulting array
will appear in any specific order; they are not, in particular,
guaranteed to appear in alphabetical order.

While that is true, i wonder … the order in which files will be listed, is not random, right? I mean, listing same files 2 times will produce the same results is this correct?

Does this mean that when files are listed on 2 different systems, order is likely to not be the same?

Ultimately the bigger question is, how to list files in a directory in same order regardless of OS file are stored on?

  • 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-06-08T23:54:26+00:00Added an answer on June 8, 2026 at 11:54 pm

    Just sort the files. File is comparable so we don’t even need a comparator:

    File[] files = File.listRoots()[0].listFiles();
    Arrays.sort(files);
    System.out.println(Arrays.asList(files));
    

    (This example simply takes the files from the first root directory, that should have some content on every computer ;))

    Alternative

    The file objects should be unique so we can create a tree set:

    for (File file : new TreeSet<File>(Arrays.asList(contentDirectory.listFiles()))) {
        System.out.println(file.getName());  // replace with magic ;)
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

we develop a data processing tool to extract some scientific results out of a
I am using Python as a script language to do some data processing and
File /usr/lib/python3.1/codecs.py, line 300, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf8'
I have tinyMCE editor which is passing data to php processing file. If I
I'd like to be able to invoke some pre-processing on files before Git tries
Hello Stack Overflow community, I am doing multistep processing on some data I am
I'm processing a source HTML file that holds tabular data in an unstructured way.
We would like to some processing in a Java application, store the results in
I am currently processing text/html data and I wish to store my results in
... // result is a JSON data passed to this function from outside var

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.