What order were files/directories output in dir? Announcing the arrival of Valued Associate...

What is the meaning of 'breadth' in breadth first search?

AppleTVs create a chatty alternate WiFi network

Why does 14 CFR have skipped subparts in my ASA 2019 FAR/AIM book?

Intuitive explanation of the rank-nullity theorem

Putting class ranking in CV, but against dept guidelines

How does the math work when buying airline miles?

Is there public access to the Meteor Crater in Arizona?

Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?

preposition before coffee

What does it mean that physics no longer uses mechanical models to describe phenomena?

Is it possible for SQL statements to execute concurrently within a single session in SQL Server?

What makes a man succeed?

Can a Beast Master ranger change beast companions?

Trademark violation for app?

What's the point of the test set?

Is it fair for a professor to grade us on the possession of past papers?

How were pictures turned from film to a big picture in a picture frame before digital scanning?

Does "shooting for effect" have contradictory meanings in different areas?

Electrolysis of water: Which equations to use? (IB Chem)

Why do early math courses focus on the cross sections of a cone and not on other 3D objects?

A term for a woman complaining about things/begging in a cute/childish way

The Nth Gryphon Number

Deconstruction is ambiguous

Why are my pictures showing a dark band on one edge?



What order were files/directories output in dir?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30UTC (7:30pm US/Eastern)Where and what was Haunt.bat? A game pre-loaded on a c1992 PCIs there a simple way to display ANSI art and animation files in a modern terminal window?Which MS-/PC-DOS version was the first to allow multiple partitions to be used?How to patch binaries in DOS?What are these tiny TSRs doing?An old DOS application that allowed to create cards, posters, invitations, etcWhat 286 chipsets support UMBs?












9















In the version of command.com included with MS-DOS, DIR seems to print files in a random order, but if one runs multiple DIR commands, they all print the files in the same order. This order does not appear to be based on date, size, or alphabetization. So what is the order? Does it simply print whatever files it finds first?










share|improve this question









New contributor




TSJNachos117 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • related: Default file order of "dir" command in Windows console, What order does the DIR command arrange files if no sort order is specified?

    – phuclv
    7 hours ago
















9















In the version of command.com included with MS-DOS, DIR seems to print files in a random order, but if one runs multiple DIR commands, they all print the files in the same order. This order does not appear to be based on date, size, or alphabetization. So what is the order? Does it simply print whatever files it finds first?










share|improve this question









New contributor




TSJNachos117 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • related: Default file order of "dir" command in Windows console, What order does the DIR command arrange files if no sort order is specified?

    – phuclv
    7 hours ago














9












9








9


1






In the version of command.com included with MS-DOS, DIR seems to print files in a random order, but if one runs multiple DIR commands, they all print the files in the same order. This order does not appear to be based on date, size, or alphabetization. So what is the order? Does it simply print whatever files it finds first?










share|improve this question









New contributor




TSJNachos117 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












In the version of command.com included with MS-DOS, DIR seems to print files in a random order, but if one runs multiple DIR commands, they all print the files in the same order. This order does not appear to be based on date, size, or alphabetization. So what is the order? Does it simply print whatever files it finds first?







ms-dos






share|improve this question









New contributor




TSJNachos117 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




TSJNachos117 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 6 hours ago









Stephen Kitt

41k8168176




41k8168176






New contributor




TSJNachos117 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









TSJNachos117TSJNachos117

1462




1462




New contributor




TSJNachos117 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





TSJNachos117 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






TSJNachos117 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • related: Default file order of "dir" command in Windows console, What order does the DIR command arrange files if no sort order is specified?

    – phuclv
    7 hours ago



















  • related: Default file order of "dir" command in Windows console, What order does the DIR command arrange files if no sort order is specified?

    – phuclv
    7 hours ago

















related: Default file order of "dir" command in Windows console, What order does the DIR command arrange files if no sort order is specified?

– phuclv
7 hours ago





related: Default file order of "dir" command in Windows console, What order does the DIR command arrange files if no sort order is specified?

– phuclv
7 hours ago










3 Answers
3






active

oldest

votes


















24














When a new file is created in a FAT-based file system, its entry will be placed in the first vacant directory slot, if there is one, or else the directory will be extended to add another cluster worth of vacant slots (and the new entry will be placed in the first of those). If no files are ever deleted, files will be assigned directory entries in the order of creation.



Before the advent of long file names, each file that was deleted would result in an empty directory slot, which would get filled by the next file to be created. Long file names complicate this process because they are stored using multiple consecutive directory slots (though I don't know the exact process).



The "dir" command in MS-DOS defaults to reporting files in the same order as their directory entries, but command-line arguments in later versions allow sorting by various criteria.






share|improve this answer
























  • Some details about long file names, by Raymond Chen: devblogs.microsoft.com/oldnewthing/20110826-00/?p=9793

    – fernando.reyes
    5 hours ago



















15














DIR lists files in the order they’re returned by the find first and find next calls.



On FAT file systems, RAM drives, CD-ROMs etc. this is the order of the directory entries on disk, which on FAT file systems is file creation order as long as no files are deleted. On network file systems, it’s whatever order the server and redirector choose. Other file system drivers can exhibit different behaviour; thus on HPFS and NTFS, which sort directories’ contents on disk, files are returned in the file systems sort order (as can be seen in OS/2 or Windows virtual DOS boxes on HPFS or NTFS volumes).



There are tools which will re-order entries on disk, to provide a permanent sort order for DIR. Defragmenting could also re-order files (commonly, directories first, then files).



DOS 5 added various sorting options to DIR itself; the order then depends only on those, when present.






share|improve this answer


























  • A VDM in OS/2 or Windows NT was a third case, halfway between. Local disc volumes weren't presented as network redirected, but neither were the underlying filesystems unsorted. They were often HPFS or NTFS where directories are sorted by their nature.

    – JdeBP
    6 hours ago



















4














Whatever it finds first. DIR in MS-DOS command.com starts at the beginning of the directory table and reads it through to the end. The files will be in the order they were added to the directory table.






share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "648"
    };
    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: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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
    },
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });






    TSJNachos117 is a new contributor. Be nice, and check out our Code of Conduct.










    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fretrocomputing.stackexchange.com%2fquestions%2f9748%2fwhat-order-were-files-directories-output-in-dir%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    24














    When a new file is created in a FAT-based file system, its entry will be placed in the first vacant directory slot, if there is one, or else the directory will be extended to add another cluster worth of vacant slots (and the new entry will be placed in the first of those). If no files are ever deleted, files will be assigned directory entries in the order of creation.



    Before the advent of long file names, each file that was deleted would result in an empty directory slot, which would get filled by the next file to be created. Long file names complicate this process because they are stored using multiple consecutive directory slots (though I don't know the exact process).



    The "dir" command in MS-DOS defaults to reporting files in the same order as their directory entries, but command-line arguments in later versions allow sorting by various criteria.






    share|improve this answer
























    • Some details about long file names, by Raymond Chen: devblogs.microsoft.com/oldnewthing/20110826-00/?p=9793

      – fernando.reyes
      5 hours ago
















    24














    When a new file is created in a FAT-based file system, its entry will be placed in the first vacant directory slot, if there is one, or else the directory will be extended to add another cluster worth of vacant slots (and the new entry will be placed in the first of those). If no files are ever deleted, files will be assigned directory entries in the order of creation.



    Before the advent of long file names, each file that was deleted would result in an empty directory slot, which would get filled by the next file to be created. Long file names complicate this process because they are stored using multiple consecutive directory slots (though I don't know the exact process).



    The "dir" command in MS-DOS defaults to reporting files in the same order as their directory entries, but command-line arguments in later versions allow sorting by various criteria.






    share|improve this answer
























    • Some details about long file names, by Raymond Chen: devblogs.microsoft.com/oldnewthing/20110826-00/?p=9793

      – fernando.reyes
      5 hours ago














    24












    24








    24







    When a new file is created in a FAT-based file system, its entry will be placed in the first vacant directory slot, if there is one, or else the directory will be extended to add another cluster worth of vacant slots (and the new entry will be placed in the first of those). If no files are ever deleted, files will be assigned directory entries in the order of creation.



    Before the advent of long file names, each file that was deleted would result in an empty directory slot, which would get filled by the next file to be created. Long file names complicate this process because they are stored using multiple consecutive directory slots (though I don't know the exact process).



    The "dir" command in MS-DOS defaults to reporting files in the same order as their directory entries, but command-line arguments in later versions allow sorting by various criteria.






    share|improve this answer













    When a new file is created in a FAT-based file system, its entry will be placed in the first vacant directory slot, if there is one, or else the directory will be extended to add another cluster worth of vacant slots (and the new entry will be placed in the first of those). If no files are ever deleted, files will be assigned directory entries in the order of creation.



    Before the advent of long file names, each file that was deleted would result in an empty directory slot, which would get filled by the next file to be created. Long file names complicate this process because they are stored using multiple consecutive directory slots (though I don't know the exact process).



    The "dir" command in MS-DOS defaults to reporting files in the same order as their directory entries, but command-line arguments in later versions allow sorting by various criteria.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 21 hours ago









    supercatsupercat

    8,030842




    8,030842













    • Some details about long file names, by Raymond Chen: devblogs.microsoft.com/oldnewthing/20110826-00/?p=9793

      – fernando.reyes
      5 hours ago



















    • Some details about long file names, by Raymond Chen: devblogs.microsoft.com/oldnewthing/20110826-00/?p=9793

      – fernando.reyes
      5 hours ago

















    Some details about long file names, by Raymond Chen: devblogs.microsoft.com/oldnewthing/20110826-00/?p=9793

    – fernando.reyes
    5 hours ago





    Some details about long file names, by Raymond Chen: devblogs.microsoft.com/oldnewthing/20110826-00/?p=9793

    – fernando.reyes
    5 hours ago











    15














    DIR lists files in the order they’re returned by the find first and find next calls.



    On FAT file systems, RAM drives, CD-ROMs etc. this is the order of the directory entries on disk, which on FAT file systems is file creation order as long as no files are deleted. On network file systems, it’s whatever order the server and redirector choose. Other file system drivers can exhibit different behaviour; thus on HPFS and NTFS, which sort directories’ contents on disk, files are returned in the file systems sort order (as can be seen in OS/2 or Windows virtual DOS boxes on HPFS or NTFS volumes).



    There are tools which will re-order entries on disk, to provide a permanent sort order for DIR. Defragmenting could also re-order files (commonly, directories first, then files).



    DOS 5 added various sorting options to DIR itself; the order then depends only on those, when present.






    share|improve this answer


























    • A VDM in OS/2 or Windows NT was a third case, halfway between. Local disc volumes weren't presented as network redirected, but neither were the underlying filesystems unsorted. They were often HPFS or NTFS where directories are sorted by their nature.

      – JdeBP
      6 hours ago
















    15














    DIR lists files in the order they’re returned by the find first and find next calls.



    On FAT file systems, RAM drives, CD-ROMs etc. this is the order of the directory entries on disk, which on FAT file systems is file creation order as long as no files are deleted. On network file systems, it’s whatever order the server and redirector choose. Other file system drivers can exhibit different behaviour; thus on HPFS and NTFS, which sort directories’ contents on disk, files are returned in the file systems sort order (as can be seen in OS/2 or Windows virtual DOS boxes on HPFS or NTFS volumes).



    There are tools which will re-order entries on disk, to provide a permanent sort order for DIR. Defragmenting could also re-order files (commonly, directories first, then files).



    DOS 5 added various sorting options to DIR itself; the order then depends only on those, when present.






    share|improve this answer


























    • A VDM in OS/2 or Windows NT was a third case, halfway between. Local disc volumes weren't presented as network redirected, but neither were the underlying filesystems unsorted. They were often HPFS or NTFS where directories are sorted by their nature.

      – JdeBP
      6 hours ago














    15












    15








    15







    DIR lists files in the order they’re returned by the find first and find next calls.



    On FAT file systems, RAM drives, CD-ROMs etc. this is the order of the directory entries on disk, which on FAT file systems is file creation order as long as no files are deleted. On network file systems, it’s whatever order the server and redirector choose. Other file system drivers can exhibit different behaviour; thus on HPFS and NTFS, which sort directories’ contents on disk, files are returned in the file systems sort order (as can be seen in OS/2 or Windows virtual DOS boxes on HPFS or NTFS volumes).



    There are tools which will re-order entries on disk, to provide a permanent sort order for DIR. Defragmenting could also re-order files (commonly, directories first, then files).



    DOS 5 added various sorting options to DIR itself; the order then depends only on those, when present.






    share|improve this answer















    DIR lists files in the order they’re returned by the find first and find next calls.



    On FAT file systems, RAM drives, CD-ROMs etc. this is the order of the directory entries on disk, which on FAT file systems is file creation order as long as no files are deleted. On network file systems, it’s whatever order the server and redirector choose. Other file system drivers can exhibit different behaviour; thus on HPFS and NTFS, which sort directories’ contents on disk, files are returned in the file systems sort order (as can be seen in OS/2 or Windows virtual DOS boxes on HPFS or NTFS volumes).



    There are tools which will re-order entries on disk, to provide a permanent sort order for DIR. Defragmenting could also re-order files (commonly, directories first, then files).



    DOS 5 added various sorting options to DIR itself; the order then depends only on those, when present.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 5 hours ago

























    answered 18 hours ago









    Stephen KittStephen Kitt

    41k8168176




    41k8168176













    • A VDM in OS/2 or Windows NT was a third case, halfway between. Local disc volumes weren't presented as network redirected, but neither were the underlying filesystems unsorted. They were often HPFS or NTFS where directories are sorted by their nature.

      – JdeBP
      6 hours ago



















    • A VDM in OS/2 or Windows NT was a third case, halfway between. Local disc volumes weren't presented as network redirected, but neither were the underlying filesystems unsorted. They were often HPFS or NTFS where directories are sorted by their nature.

      – JdeBP
      6 hours ago

















    A VDM in OS/2 or Windows NT was a third case, halfway between. Local disc volumes weren't presented as network redirected, but neither were the underlying filesystems unsorted. They were often HPFS or NTFS where directories are sorted by their nature.

    – JdeBP
    6 hours ago





    A VDM in OS/2 or Windows NT was a third case, halfway between. Local disc volumes weren't presented as network redirected, but neither were the underlying filesystems unsorted. They were often HPFS or NTFS where directories are sorted by their nature.

    – JdeBP
    6 hours ago











    4














    Whatever it finds first. DIR in MS-DOS command.com starts at the beginning of the directory table and reads it through to the end. The files will be in the order they were added to the directory table.






    share|improve this answer




























      4














      Whatever it finds first. DIR in MS-DOS command.com starts at the beginning of the directory table and reads it through to the end. The files will be in the order they were added to the directory table.






      share|improve this answer


























        4












        4








        4







        Whatever it finds first. DIR in MS-DOS command.com starts at the beginning of the directory table and reads it through to the end. The files will be in the order they were added to the directory table.






        share|improve this answer













        Whatever it finds first. DIR in MS-DOS command.com starts at the beginning of the directory table and reads it through to the end. The files will be in the order they were added to the directory table.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 23 hours ago









        RETRACRETRAC

        915311




        915311






















            TSJNachos117 is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            TSJNachos117 is a new contributor. Be nice, and check out our Code of Conduct.













            TSJNachos117 is a new contributor. Be nice, and check out our Code of Conduct.












            TSJNachos117 is a new contributor. Be nice, and check out our Code of Conduct.
















            Thanks for contributing an answer to Retrocomputing Stack Exchange!


            • 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%2fretrocomputing.stackexchange.com%2fquestions%2f9748%2fwhat-order-were-files-directories-output-in-dir%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

            Cannot install PyQt5 The Next CEO of Stack OverflowCannot install tcpreplay 3.4.4cannot...

            Kapp-Putsch Acontecimentos | Outros artigos | Menu de navegação

            Why did early computer designers eschew integers? The Next CEO of Stack OverflowWhat register...