| |
You are here: Experts > Computing/Technology > Focus on Windows > Windows 95/98 > batch filenames
Expert: Kevin - 10/27/2009
Question QUESTION: Kevin,
I will post the previous response from a long time ago that worked great for me except I received too much info with the file names. I only want the file name please tell me how to eliminate everything else in Notepad. I'm Vista but this worked. Below is the original answer:
Thanks for helping,
Tina
Hi Sebastian, all you need to do is go into DOS and do this. But to make your life simple, I will create a batch file for you. All you have to do is open up Notepad and copy and paste the following into it:
dir > filenames.txt
close
Then save the above as "filenames.bat" WITH the quotes. You must include the quotes. Save it to your Desktop or some other folder. Now COPY filenames.bat to any one of the folders that you want to show the filenames. So if you want to see the filenames in a folder called Downloads and another called Pictures, make a copy to both. Not a shortcut, but a full copy.
When you have copied that file to the folder, just double click on filenames.bat and it should run automatically. Now look in the same folder for a file called filenames.txt and open it. It should have the list of filenames and other information. There are a lot of ways to display how you want it in Notepad. If you don't want all the information, like the file size, etc, post me a followup on what you want and I will get back to you.
Hope that helps.
Kevin.
ANSWER: Hi Tina, give the following a try:
dir /b > filenames.txt
close
Kevin.
Kevin's Resource Center - http://www.greyknight17.com
KRC Forum - http://www.greyknight17.com/bb
---------- FOLLOW-UP ----------
QUESTION: Kevin,
That worked great and such a quick response! Can I also eliminate the file extension?
Thanks,
Tina
Answer Hi Tina, try the following:
@echo off
setlocal
set List=C:\*.*
for /f "delims=" %%a in ('dir /b "%List%"') do echo %%~na >> filenames.txt
Replace the following line:
set List=C:\*.*
With the path you want. For example, c:\myfolder\*.*
Once you double click on it, it will create a file called filenames.txt. Feel free to change that name in the script if you want.
Kevin.
Kevin's Resource Center - http://www.greyknight17.com
KRC Forum - http://www.greyknight17.com/bb
Add to this Answer Ask a Question
|
|