Save me from having to retype 2,600 file names.
September 9, 2008 2:29 PM   Subscribe

In Windows, is there a way to get a text listing of all of the files in a folder?

I have a folder which contains about 50 subfolders comprising about 2,600 files. I'd like a text listing of the file names and what folder they're in (so I can make a html-ized listing of them all, for when they eventually get moved into a web directory). Is there any way to generate this automagically?
posted by joannemerriam to Computers & Internet (13 answers total) 2 users marked this as a favorite
You can use MS-DOS to dump a file list into a text file.
posted by nitsuj at 2:43 PM on September 9, 2008

In the command prompt type:

cd C:\stuff\bigfolder\
hit enter and then type
dir /S > C:\filenames.txt

That will make a text file named filename.txt that lists all the files in bigfolder and its subfolders.
posted by rancidchickn at 2:44 PM on September 9, 2008

justin beat me by a second, yarrr. Note the subdirectory command on that page that you can append to your dir to get it to include files in subdirectories.
posted by Askr at 2:45 PM on September 9, 2008

There's a couple of ways to attack this:

1) Via the command-line interace.

Start -> Run -> CMD, then type:

cd /d "C:\directory\your folder"

then type,

"DIR /B >filenameyouchoose.txt"

2) Check out this article and follow the directions within.

Hope that helps.
posted by karizma at 2:45 PM on September 9, 2008

I don't know if you are willing to download software for this, but if you get cygwin, you can perform this operation within the bash shell pretty easily, just use find . > outfile.txt. You can even limit it to just a particular extension if you want: find . -name "*.mp3" > musicfiles.txt for example.

There's a lot of other fancy stuff you can do with cygwin too, which may make it possible to automate even the creation of the HTML page.

or you could use what the other users posted too.. I'm slow.
posted by jamuraa at 2:47 PM on September 9, 2008

in a dos-box type: dir [directory] /s /-D /b > list.txt


dir c:\temp /s /D /b > list.txt

or else use the cd command to go to the correct directory and type: dir /s /-D /b >list.txt
posted by RobHoi at 2:49 PM on September 9, 2008

If you're running a Mac, I asked this exact question a couple months ago here.
posted by InsanePenguin at 3:39 PM on September 9, 2008

I should have said, if you're running OS X OR Linux.
posted by InsanePenguin at 3:40 PM on September 9, 2008

I have an Excel macro that Mefite NailstheCat created and helped me with once when I saw he answered a similar question previously. I can email the file to you if you'd like.
posted by chiababe at 3:45 PM on September 9, 2008

Seconding cygwin. I think the command would be easiest as:
"ls > filename"
posted by Raichle at 4:08 PM on September 9, 2008

Sorry, correction. Since many of the filenames are presumably in embedded folders, you would want to use:

ls -R > filename
posted by Raichle at 4:10 PM on September 9, 2008

Then, if your syntax is the same as mine you can get all the folder names independently with something like:
grep ./*:

Look around for grep, cut, sed tutorials, they are really powerful tools when combined with cygwin. Good Luck!
posted by Raichle at 4:17 PM on September 9, 2008

Response by poster: Thanks, everybody.
posted by joannemerriam at 8:17 PM on September 9, 2008

« Older How much do PHP developers in NYC get paid?   |   Animal Farm - apartment style Newer »
This thread is closed to new comments.