how to create list of files in alpha order with dos command?

Discussion in 'Computers' started by Kyle McKnight, Oct 8, 2003.

  1. Kyle McKnight

    Kyle McKnight Cinematographer

    Joined:
    Mar 8, 2001
    Messages:
    2,504
    Likes Received:
    0
    OK. I've got WinXP, and sometime a long, long time ago, someone sent me a DOS command to run from the cmd prompt to create a list of all my MP3 files located in a certain directory.

    It listed in alphabetical order via subdirectories, then listed the files in order in each one.

    Can anyone help?
     
  2. Mark Dubbelboer

    Mark Dubbelboer Screenwriter

    Joined:
    Oct 6, 1999
    Messages:
    1,008
    Likes Received:
    0
    dir/? will give you the options

    i think what you want is
    "dir/s/on"

    /s shows directory and subdirectories
    /on orders by name

    hope that helps
     
  3. Kyle McKnight

    Kyle McKnight Cinematographer

    Joined:
    Mar 8, 2001
    Messages:
    2,504
    Likes Received:
    0
    Ya, I've tried so many different things, and just can't get the list to be alphabetical. I keep coming up with this. Thanks for the help though.
     
  4. Brett_H

    Brett_H Second Unit

    Joined:
    Oct 3, 2001
    Messages:
    341
    Likes Received:
    0
    Kyle,

    Try "dir /a-d /on /s /b"

    "/a-d" excludes directories, which is what you want.
    "/b" is "bare" format, just the names, no file sizes.

    Hope this helps. (Note: I'm on Win2K, I'm hoping XP is similar since it's based on Win2K.)

    -Brett.
     
  5. Ted Lee

    Ted Lee Lead Actor

    Joined:
    May 8, 2001
    Messages:
    8,390
    Likes Received:
    0
    is there a specific reason you want to do it from dos? i know i have some freeware app on my pc at home that will list all the files of any given directory and subdirectory if you specify. you can even export the data to excel, etc.

    can't remember what it's called though...i can check when i get home if you're interested.

    i did a quick search on cnet and came up with something like this which may also work:

    http://download.com.com/3000-2248-10...ml?tag=lst-0-4

    [edit] - can you take your txt file and import it into excel, then sort that way?
     
  6. Christian Behrens

    Christian Behrens Supporting Actor

    Joined:
    Mar 2, 2000
    Messages:
    713
    Likes Received:
    0
    Location:
    SF Bay Area
    Real Name:
    Christian Behrens
    I use Brett's exact command as well when I need just filenames in alphabetical order. Only I would write them to a file:

    dir /a-d /on /s /b > dir.txt

    This was on NT, but as it works for Brett on W2K, I'd be surprised if it doesn't work on XP then as well.

    -Christian
     
  7. Kyle McKnight

    Kyle McKnight Cinematographer

    Joined:
    Mar 8, 2001
    Messages:
    2,504
    Likes Received:
    0
    I don't know if it's something funky with my system or not. Running them from the command prompt, I keep getting the same thing I linked to above.

    Ted, thanks for the link to that program. My computer must be stupid or something. Even when usuing that program, and telling it to put the files in ascending order, it still comes out the exact same way as I have linked above....doesn't even change when I tell it to go descending.

    (here is link again)
     
  8. Ken Chan

    Ken Chan Producer

    Joined:
    Apr 11, 1999
    Messages:
    3,301
    Likes Received:
    0
    Maybe it's sorting on the short file names instead? In any given directory, try

    dir /x /on

    The short name is the second-to-last column. Are those sorted, but the long names (the last column) are not?

    In any case, you should be able to sort by using the aptly named SORT utility:

    dir /a-d /on /s /b | sort

    or to put it in a text file:

    dir /a-d /on /s /b | sort > someotherdirectorydir.txt

    (If you don't put the text file in another directory, it gets included in the list you generate.)

    //Ken
     
  9. Ted Lee

    Ted Lee Lead Actor

    Joined:
    May 8, 2001
    Messages:
    8,390
    Likes Received:
    0
    that's weird that it won't work even using that program.

    heck...i guess if all else fails, copy your text file and export it to excel, then sort it. i did it and it sorted perfectly. [​IMG]

    [edit] btw, the program i'm using is called max lister. works pretty well for me...
     
  10. Kyle McKnight

    Kyle McKnight Cinematographer

    Joined:
    Mar 8, 2001
    Messages:
    2,504
    Likes Received:
    0
    Ken, that worked perfect for me. Thanks to everyone for the help.
     

Share This Page