Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File names in a list

Status
Not open for further replies.

puredesi5

Programmer
Sep 26, 2001
50
0
0
US
Is there a way to get file names in an Excel format or text file.
For example:
Folder1
File1
File2
File3, etc

I would like to get each file name in a separate row on a spreadsheet or a text file. Is it possible
 
Yes, it is possible, but where are the file names now? Don't know how to suggest you put them into a file if we don't know where you are getting these file names.
 
I apologize if it wasn't clear--The file names would be from any windows directory on 'C' drive or any other drive for that matter.
Perhaps I will explain what I would use it for and it will make sense. I bought few music albums and loaded on my PC. I want to make list of all songs. Rather than go to each track, copy file name on a spreadsheet (or text file), I thought there might be way that I can get all song titles on a spreadsheet without doing it manually.
 
Go to the DOS prompt (Start menu, run, "cmd")
At the DOS prompt, enter cd c:\ which will get you to the root directory.
Then to get to the directory where you have stored your music, type "cd {foldename}" where "{foldername}" is the folder name where you want to be. Of course, if the folder you want is not directly under the root directory, then use the whole path. You can also do them one folder at a time. Such as cd "program files" then cd "microsoft office" To do them both at the same time, cd "program files\microsoft office"

Once you get to the folder where your music is,then you can do this command: dir *.mp3 >musicnames.txt

The dir does a diretory listing of the folder, the *.mp3 will list all files with mp3 as the suffix. The > causes output of the directory listing to be sent to a file. The musicnames.txt is the name of the file where the directory listing will be sent.

At the end of this, you will have the file names listed in a text file, one name per line.

Hope this helps,
Vic
 
Here is an alternative method using Word (Can't remember the source - don't know whom to credit):

Making a list of filenames from a Directory in Word

When you drag and drop the filenames onto a Word document using the right mouse button, you get a menu that includes the option Create Hyperlink Here. After doing so, highlight all the resulting hyperlinks, press Ctrl-X to cut them to the clipboard, and select Edit | Paste Special from the menu. In the list of formats, select Unformatted text, then click on OK.
You now have a listing of all the selected files, but each filename is preceded by the full path, and the filenames are not on separate lines. Highlight the pathname portion of any one file, including the final backslash, and press Ctrl-C to copy it to the clipboard. Highlight all of the files and press Ctrl-H to bring up the Find and Replace dialog. Paste the path into the Find what box, and enter ^p in the Replace with box. After you click on Replace all, you'll have a nice listing of all the files, each on its own line, without the preceding path information.
 
Thank you all (VicRauch, ylustrata, & Firefytr)!

I tried getting list from Dos, worked as I needed. Thanks VicRauch. I haven't tried using MS Word. I downloaded the pgm mentioned on the site (haven't run it yet). It appears this is exactly what I need.
Once again, thank you all of you.

This is wonderful site to learn & share information.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top