How to copy a list of file names in a folder to text file?

Page 1 of 2 12 LastLast

  1. Posts : 19
    Windows 10
       #1

    How to copy a list of file names in a folder to text file?


    Hi.
    Below link shows a method to do that, but its probably for older versions of windows.
    How to Copy a List of Files in a Windows Folder Into an Excel List | Chron.com

    In windows 10, when I Shift+right click on a folder to open the Powershell window and type dir /b > dirlist.txt to generate a text file of filenames in the folder, this command is returned as invalid.

    Would be grateful for any help.
    Regards.
      My Computer


  2. Posts : 7,034
    windows 10
       #2

    Use cmd prompt dir *.* > Duelist.txt
      My Computer


  3. Posts : 25,314
    10 Home x64 (21H2) (10 Pro on 2nd pc)
       #3

    seymoria said:
    In windows 10, when I Shift+right click on a folder to open the Powershell window and type dir /b > dirlist.txt to generate a text file of filenames in the folder, this command is returned as invalid.
    It's because you used /b which is a valid option in a command prompt, but not in Powershell. Redirecting to a text file works in Powershell if you just type dir > dirlist.txt

    You can switch to using a command prompt in Powershell by typing cmd, then you'd be able to use dir /b. Type exit to return to Powershell.
      My Computers


  4. Posts : 19
    Windows 10
    Thread Starter
       #4

    Hello guys.

    Thanks so much, problem got solved very simply.
    Indebted for your kind advice.

    Best regards
      My Computer


  5. Posts : 79
    Microsoft Windows 10 Pro 20H1 (Os Build 19043.1165)
       #5

    seymoria said:
    Hi.
    Below link shows a method to do that, but its probably for older versions of windows.
    How to Copy a List of Files in a Windows Folder Into an Excel List | Chron.com

    In windows 10, when I Shift+right click on a folder to open the Powershell window and type dir /b > dirlist.txt to generate a text file of filenames in the folder, this command is returned as invalid.

    Would be grateful for any help.
    Regards.
    Can someone please explain this in simpler words I do not know how to use Powershell or CMD to generate one please help
      My Computers


  6. Posts : 16,338
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #6

    Hello @kufr,

    kufr said:
    Can someone please explain this in simpler words I do not know how to use Powershell or CMD to generate one please help.
    If you want a list of filenames in a folder you might be better off using this . . .

    Add Copy Contents to Clipboard to Context Menu in Windows 10

    I hope this helps.
      My Computer



  7. Posts : 13,961
    Windows 10 Pro X64 21H1 19043.1503
       #7

    I do this via an entry in the Context Menu for File Explorer.

    Add a Create File List entry to the right click Context Menu for File Explorer. It calls a batch file (.bat) that creates a list of all the files in a folder and writes it to a file in the default temp directory, then opens notepad with that file and then deletes the file. Just tested it on my Win 10 Pro X64 system and it works great.

    information   Information
    If you want to keep the GenFIleList.txt file around for awhile, remove & del %temp%\GenFileList.txt from the end of the line in the batch file.


    Here is the batch file I use. You can change it to do whatever you need.

    dir /a /-p /o:gen %1 >%temp%\GenFileList.txt & notepad %temp%\GenFileList.txt & del %temp%\GenFileList.txt

    To create the batch file:


    1. Select the above line of text.
    2. Press [Ctrl+C] to copy it to the Clipboard.
    3. Open Notepad and press [Ctrl+V] to pastes it into the Notepad window.
    4. Click on [File] then [Save as].
    5. Make the name "GenFileList.bat", including the double quotes so Windows 10 doesn't add .txt to the end.
    6. Place Genfilelist.bat in c:\users\yourname folder.


    Here is the .reg file I use.


    1. You need to change yourname to your account name in two places.
    2. Set the isLink\command lines @= entry in the reg file to the path you created GenFileList.bat in, for example:

    c:\users\yourname\GenFileList.bat

    ==================================================================================================== ===
    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\*\shell\isLink]
    @="Create File List"
    "Extended"=""

    [HKEY_CLASSES_ROOT\*\shell\]
    @=""c:\\users\\yourname\\GenFileList.bat" "%1""

    [HKEY_CLASSES_ROOT\Directory\shell\isLink]
    @="Create File List"
    "Extended"=""

    [HKEY_CLASSES_ROOT\Directory\shell\isLink\command]
    @=""c:\\users\\yourname\\GenFileList.bat" "%1""

    ==================================================================================================== ===

    Select all the red text between the ======================='s
    Press [Ctrl+C] to copy it to the Clipboard.
    Open Notepad and press [Ctrl+V] to pastes it into the Notepad window.
    Click on [File] then [Save as].
    Make the name "AddGenFileList.reg", including the double quotes so Windows 10 doesn't add .txt to the end.
    Place AddGenFileList.reg in the same folder you put Genfilelist.bat in.

    Now double click on AddGenFileList.reg to add it's data to the registry. Click Yes or OK as necessary.

    To use, do the following:

    Open File Explorer and navigate to the folder you want the file list for. Right click on it and select [Create File List].

    Notepad will open with the list of files and folders contained in the folder you chose. You can edit it or do whatever you
    want with the data as well as print it.
      My Computers


  8. Posts : 79
    Microsoft Windows 10 Pro 20H1 (Os Build 19043.1165)
       #8

    Ztruker said:
    I do this via an entry in the Context Menu for File Explorer.
    Isn't there already a .bat file or something that I can click and it will install itself this is too technical for me
      My Computers


  9. Posts : 13,961
    Windows 10 Pro X64 21H1 19043.1503
       #9

    Did you try following the directions? It's really not difficult. Just do exactly what it says.

    I'll work on a install batch file when I get a few minutes but it will be awhile.
      My Computers


  10. Posts : 13,961
    Windows 10 Pro X64 21H1 19043.1503
       #10

    Okay, had some time to play with this.

    GenFileList.bat - Click here to go to the BSOD batch repository to download and run this batch file.
    Last edited by Ztruker; 01 Oct 2020 at 10:37.
      My Computers


 

  Related Discussions
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 21:00.
Find Us




Windows 10 Forums