How to make list of files in a folder?

Page 1 of 2 12 LastLast

  1. Posts : 37
    Windows 10 X64
       #1

    How to make list of files in a folder?


    Can someone please tell me How to make list of files in a folder using cmd? Thanks.
      My Computer


  2. Posts : 2,487
    Windows 10 Home, 64-bit
       #2

    dir f:\Music /b /s > c:\textfile.txt

    The above command will make a list of all files in the Music folder of the F drive, including subdirectories. The list will be found in the root of the C drive under the name "textfile.txt".

    Adapt it to your needs.
      My Computer


  3. Posts : 75
    Windows 10 Pro (1909)
       #3

    There is a tiny (just 124 KB) utillity named LS File List Generator. Easier than cmd and no need to install of course. I use it from the Win 2000 era. Check the Attachment.
    How to make list of files in a folder? Attached Files
      My Computer


  4. Posts : 16,950
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #4

    ignatzatsonic said:
    dir f:\Music /b /s > c:\textfile.txt

    The above command will make a list of all files in the Music folder of the F drive, including subdirectories. The list will be found in the root of the C drive under the name "textfile.txt".

    Adapt it to your needs.
    Don't try to write a file to the OS drive's root folder c:\. You'll get Access denied because that location is protected.

    Denis
      My Computer


  5. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #5

    Hello @Takeshi18,

    Direct the output to the Desktop . . .

    Code:
     > "%UserProfile%\Desktop\<filename>.txt"

    I hope this helps!
      My Computer


  6. Posts : 56,830
    Multi-boot Windows 10/11 - RTM, RP, Beta, and Insider
       #6

    Then, borrowing (swiping ) from all above, the final version would be:

    dir f:\Music /b /s > "%UserProfile%\Desktop\filelist.txt"



    (My choice of "filelist")
      My Computers


  7. Posts : 1,767
    Windows 10 Pro (+ Windows 10 Home VMs for testing)
       #7
      My Computer


  8. Posts : 265
    Windows 10 Enterprise
       #8

    And with Powershell cmd prompt:

    Get-ChildItem C:\Temp -Name | tee-object c:\temp\names.txt

    Just another way to do what you want...
      My Computer


  9. Posts : 14,046
    Windows 11 Pro X64 22H2 22621.1848
       #9

    Actually that would be: Get-ChildItem -Path F:\Music -r | tee-object $env:userprofile\desktop\filelist.txt
      My Computers


  10. Posts : 16,950
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #10

    If the user Desktop folder might have been relocated then the PS would need to be

    Code:
    $path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
    $UserDesktop = (Get-ItemProperty -Path $path -Name "Desktop").Desktop
    Get-ChildItem -Path "F:\Music or whatever" -r | tee-object "$UserDesktop\FileList.txt"
    - Put the folder of interest in place of 'F:\Music or whatever' and ensure you keep the quotation marks if the path has any spaces in it.
    - Put whatever file name.extension you want in place of 'FileList.txt 'and ensure you keep the quotation marks if the filename, the Desktop path or the UserName have [or might have] any spaces in them.


    Denis
      My Computer


 

  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 18:48.
Find Us




Windows 10 Forums