[windows 7] trying to get a list of file names...
I need to get a list of all file names in a folder. I found dir /b > print.txt which was good but not perfect, as I only want the file names themselves but it prints the file names and types. So instead of "image_1" it gives "image_1.png" which is annoying.
I found a thing on the googles that I thought would be helpful, a microsoft fixit that you run and would add a context menu for right clicks, but it does not do what I want it to at all.
@echo off dir %1 /-p /o:gn > "%temp%\Listing" start /w notepad /p "%temp%\Listing" del "%temp%\Listing" exit
I dont know what that mess means to edit it or how to remove it now.
If there is no command line to get the file names without the .png then my next best goal would be to edit the context command to do /dir text thing rather than trying to print it through a printer.
Thanks in advance for any help
Posted Jan 19, 2016, 11:24 PM UTC
the extension is part of the filename, windows' filemanager just doesn't display it. actually i don't know and that's just how it is in linux/unix.
It's the same way in windows, yes.
Filenames in windows are just parsed from the back to find the last period, then everything that follows is an "extension". Linux uses the same technique, but usually inspects the files to try to guess what the type is first.
wow we've arrived at the point where people began thinking that the filename of "readme.txt" is "readme" and the extension is seperate from that..
thanks microsoft, idiots.
instead of not showing extensions, they just should have done it how nautilus does it. when renaming the extension isn't automatically selected.
Microsoft does this. However I agree that the extensions shouldn't be hidden by default. It be great if a general user knew that a .bat file could harm their PC.