Windows 10: I'd like to generate a list with *only* file names Solved

  1.    26 Dec 2015 #1

    I'd like to generate a list with *only* file names

    - Winkey, “cmd”
    - “cd e:\media\trainingvids”
    - “dir *.* /s /b /a -d > c:\temp\dork.txt”

    So, with that I'm opening a command prompt, changing to the correct directory, doing a directory listing of all files (including sub-directories (/s), no headers or footers so 'bare' format (/b), and trying to NOT display the directory (/a -d) – and then sending/piping that (>) to a file I've designated to be named and created (dork.txt) in a temporary directory (\temp) that already exists on my c:\.

    The problem is that it doesn't work. I'm not able to find a way to NOT include the full path along with the file names. I want a resultant file that JUST has the full file names, and could use some quick help with syntax, or maybe I've got it all wrong and it can't be done in this way.

    I need the process to work for both Windows 10 and Windows 7 machines, so hopefully there is no difference in the DOS syntax between the two, as I know there were slight differences with much older DOS versions.

    Of course, if there are sexy new ways to achieve this list in Windows 10, I'm all ears.

    - dir (command) - Wikipedia, the free encyclopedia
    Last edited by FoxyBoxOfRox; 03 Jan 2016 at 17:10.
      My ComputerSystem Spec

  2. topgundcp's Avatar
    Posts : 2,438
    Ubuntu14.04x64 MintMate17x64 Win10Prox64
       26 Dec 2015 #2
      My ComputerSystem Spec

  3. Brink's Avatar
    Posts : 33,116
    64-bit Windows 10 Pro build 18262
       26 Dec 2015 #3

    Hello FoxyBoxOfRox, and welcome to Ten Forums. :)

    You might also see if the context menu below may be able to help with this.

    Context Menu - Add View and Print File Directory
      My ComputersSystem Spec

  4.    03 Jan 2016 #4

    Still Open

    Thank you everyone, but I'm going to change my request to DOS only. I need a batch file to work.

    And using batch files with Basic code is still a function available within Windows 10, so I don't believe I'm off-topic.

    Thank you in advance, if anyone can help me get this syntax sorted!
      My ComputerSystem Spec

  5. Ztruker's Avatar
    Posts : 6,415
    Windows 10 Pro X64 17134.191
       03 Jan 2016 #5

    I think you need to pipe the output of dir to a file then read it with the batch FOR command:

    See here: Batch Script Parsing Dir Command
      My ComputersSystem Spec

  6.    04 Jan 2016 #6


    Thanks Ztruker. The boys over there at StackOverflow solved it for me. (You have to use a For loop.)

    To those that come across this thread: just right-click and create a new Text Document file and name it whatever you want, and locate it wherever you want, but you have to change the .txt file extension to .bat for it to run (e.g. GetFileNames.bat), and paste the DOS Basic code below into it. Change the directory values in the code as needed, and also whatever resultant inventory file name you want. Double click on your new Batch file from within Explorer to generate the new inventory text file (e.g. dork.txt -or- name it FileInventory.txt).

    Each time you run the Batch file, the old inventory file will be overwritten, so you'll have to move it first, or just rename it, if you want the old inventory values.

    Also note that you can change the *.* value to .pdf if you want an inventory of just the PDF files. Or .mp3 if you just want those music files, etc. Any file type you want an inventory of.

    @echo off
    > "C:\temp\dork.txt" (
        for /F "eol=| delims=" %%F in ('
            dir /B /S /A:-D "E:\media\trainingvids\*.*"
        ') do (
      My ComputerSystem Spec

  7. Ztruker's Avatar
    Posts : 6,415
    Windows 10 Pro X64 17134.191
       04 Jan 2016 #7

    Good, glad you got it working.
      My ComputersSystem Spec


Related Threads
Hello, I use Notepad++ to edit Python files which have the file extension .py such as "" I would like to set Notepad++ as the default program to open .py files. When I open a .py file I get the popup asking me which file I want to use...
I have a problem with a program not saving preset data. Possibly due to harlink extenstion with only one piece of software. I use symbolic hardlinks on my system but I do not know if the following has any bearing on the issue with the software I...
I've used Linux for about five years and just switched to Windows 10, and it seems that file names are being abbreviated by the new system. This was obvious when I copied some document files to the new system, and not recognizing my files is rather...
I have a new laptop, so unless this is some weird feature that's specific to the laptop, then I assume it's a Windows 10 settings issue because I've never encountered anything like this before. I downloaded several JPGs and PDFs from various emails...
A brief apology: I'm probably too old to mess with this stuff (pulling 80,) but I like to try. Please be patient with me, and ask for details if I am not stating my problem clearly. I have searched, but could not find this problem already...
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 23:54.
Find Us