Creating a list of files within a directory

There’s been so many times where I needed to get a list of files that reside within a certain directory. There’s software out there to do it (like DDFilecatcher), but who wants to pay for it? It seems like it would be so simple just to create a little script that’ll take the names of all the files I have in a folder and save it to a .txt file. Well, here’s how you do it.

  1. Open notepad
  2. Put this code into the file

    dir /b>filelist.txt

  3. Save it as “filelist.bat”
  4. Place filelist.bat into the directory you need to get the list from
  5. Click on filelist.bat from within the folder
  6. You’ll now have a .txt doc called “filelist.txt”
  7. Simple, right? This has saved me so much time… it’s ridiculous.

    filelist

    Popularity: 4% [?]

Comments

  1. You can also just skip the .bat file and dump in the command line…

    dir >files.txt (all files/folders/etc)
    dir /ad >dirs.txt (all directories into file called dirs.txt)
    dir *.doc >doc.txt (all files ending in .doc)
    etc…

    dir (conditions) >filename.ext


    Tully
    July 13th, 2009
  2. This is so simple yet so useful!
    Lot’s of times I needed to do it :D Thanks for the tip.


    Ahmad Alfy
    July 26th, 2009
  3. But it works well with Roman languages only.. For Russian, for example (where 1 letter is 2 bits), it’s not good at all.


    slaFFik
    November 23rd, 2009

follow me on twitter RSSSubscribe, Dude.