1.    26 Dec 2015 #1
    Join Date : Dec 2015
    Posts : 6
    Windows 10

    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.

    Reference:
    - dir (command) - Wikipedia, the free encyclopedia
    Last edited by FoxyBoxOfRox; 03 Jan 2016 at 17:10.
      My ComputerSystem Spec
  2.    26 Dec 2015 #2
    Join Date : Jul 2014
    San Jose, California
    Posts : 2,061
    Ubuntu14.04x64 MintMate17x64 Win10Prox64
      My ComputerSystem Spec
  3.    26 Dec 2015 #3
    Join Date : Oct 2013
    Posts : 24,502
    64-bit Windows 10 Pro build 17017

    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
    Join Date : Dec 2015
    Posts : 6
    Windows 10
    Thread Starter

    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.    03 Jan 2016 #5
    Join Date : Apr 2014
    Space coast of Florida
    Posts : 5,252
    Windows 10 Pro X64 15063.483

    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
    Join Date : Dec 2015
    Posts : 6
    Windows 10
    Thread Starter

    Solved


    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.

    Code:
    @echo off
    > "C:\temp\dork.txt" (
        for /F "eol=| delims=" %%F in ('
            dir /B /S /A:-D "E:\media\trainingvids\*.*"
        ') do (
            echo(%%~nxF
        )
    )
      My ComputerSystem Spec
  7.    04 Jan 2016 #7
    Join Date : Apr 2014
    Space coast of Florida
    Posts : 5,252
    Windows 10 Pro X64 15063.483

    Good, glad you got it working.
      My ComputersSystem Spec

 


Similar Threads
Thread Forum
Solved File extension not in file association list
Hello, I use Notepad++ to edit Python files which have the file extension .py such as "sample.py" 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...
General Support
Solved Data files not saving correctly [File names but zero byte files]
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...
Software and Apps
Why Does Windows 10 Abbreviate File Names?
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...
General Support
Files automatically renaming themselves, duplicate file names
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...
General Support
Solved File names in Left Panel of File Explorer
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...
General Support
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 14:07.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums