Copy folder or file names as a text file

Page 1 of 2 12 LastLast

  1. Posts : 1,523
    windows 10 PRO
       #1

    Copy folder or file names as a text file


    Hi

    i have an extension called copy file names but doesn’t work very well, mucks up the order....

    if i I use the windows option it works but I get more info than I need, I simply want the file name...

    are there switches Cher’s I can use to achieve this ..?

    thanks
      My Computer


  2. Posts : 4,158
    Windows 11 Pro, 22H2
       #2

    If you simply want file names in a folder run this command from a command prompt:

    Code:
    dir /b > FileList.txt
    This will run a DIR command in the current folder and save the results to a file called FileList.txt. Make sure that you are in the folder that you want a listing from or otherwise specify the path like this:

    Code:
    dir C:\SomePath /b FileList.txt
    If you want to include subfolders, run it like this:

    Code:
    dir C:\SomePath /b /s > FileList.txt
    If you want FileList.txt to be created elsewhere, just specify the path like this:

    Code:
    dir C:\SomePath /b /s > D:\MyPath\FileList.txt
      My Computers


  3. Posts : 1,523
    windows 10 PRO
    Thread Starter
       #3

    Hi I tried this but it doesn’t simply give the file names it gives a bunch of other info as well.....

    simply want. File-full-of-usefully-stuff, or whatever the file name is don’t want the creation date etc etc....

    thanks
      My Computer


  4. Posts : 582
    Windows 10 Home
       #4

    Please repost with more information, including an example of the full path of the target folder for this operation and whether you want files, folders or both.

    Ben
    Last edited by Ben Myers; 28 Jun 2019 at 20:50.
      My Computer


  5. Posts : 14,047
    Windows 11 Pro X64 22H2 22621.1848
       #5

    This batch file used to work for me along with an accompanying .reg file but the start /wait does not seem to be working any more. Don't know what version fo Windows 10 Command Prompt that got broken in as I have not used this in a long time. Anyway, here are the batch and reg files. Maybe you or one of the other folk here can figure it out. I'm stumped at the moment.

    Printdir.bat

    Code:
    @echo %1%
    dir "%1" /-p /o:gn > "%temp%\Listing"
    start /wait notepad /p "%temp%\Listing"
    del "%temp%\Listing"
    exit
    Printdir.reg
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Directory\Shell]
    @="none"
    
    [HKEY_CLASSES_ROOT\Directory\Shell\Print_Directory_Listing]
    @="Print Directory Listing"
    
    [HKEY_CLASSES_ROOT\Directory\shell\Print_Directory_Listing\command]
    @="Printdir.bat \"%1\""
    
    [HKEY_CLASSES_ROOT\SOFTWARE\Classes\Directory]
    "BrowserFlags"=dword:00000008
    
    [HKEY_CLASSES_ROOT\SOFTWARE\Classes\Directory\shell\Print_Directory_Listing]
    @="Print Directory Listing"
    
    [HKEY_CLASSES_ROOT\SOFTWARE\Classes\Directory\shell\Print_Directory_Listing\command]
    @="Printdir.bat \"%1\""
    
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\AttachmentExecute\{0002DF01-0000-0000-C000-000000000046}]
    @=""
    
    [HKEY_CLASSES_ROOT\SOFTWARE\Classes\Directory]
    "EditFlags"="000001d2"
    Double click on Printdir.reg to merge it into the registry (Create a System Restore point or backup the registry first).

    Put Printdir.bat somewhere in the path (type path from a command prompt to see what that is set to).

    Now you are supposed to be able to right click on a folder, select Print Directory and a listing of that directory (Folder) opens in Notepad. This used to work but is not working now. I don't know what the problem is yet, but once I figure it out I'll post an update here. If someone else figures it out please also post here.
      My Computers


  6. Posts : 4,158
    Windows 11 Pro, 22H2
       #6

    reddwarf4ever said:
    Hi I tried this but it doesn’t simply give the file names it gives a bunch of other info as well.....

    simply want. File-full-of-usefully-stuff, or whatever the file name is don’t want the creation date etc etc....

    thanks
    Perhaps you didn't try it as I actually posted. With the "/b" switch it gives YOU NOTHING BUT THE FILE NAMES.

    Here is an example:

    Code:
    Microsoft Windows [Version 10.0.18362.207]
    (c) 2019 Microsoft Corporation. All rights reserved.
    
    C:\Users\winuser>dir /b
    .VirtualBox
    3D Objects
    Contacts
    Desktop
    Documents
    Downloads
    Favorites
    Links
    Music
    OneDrive
    Pictures
    SampleFile.txt
    Saved Games
    Searches
    Videos
    
    C:\Users\winuser>
      My Computers


  7. Posts : 1,523
    windows 10 PRO
    Thread Starter
       #7

    hsehestedt said:
    Perhaps you didn't try it as I actually posted. With the "/b" switch it gives YOU NOTHING BUT THE FILE NAMES.

    Here is an example:

    Code:
    Microsoft Windows [Version 10.0.18362.207]
    (c) 2019 Microsoft Corporation. All rights reserved.
    
    C:\Users\winuser>dir /b
    .VirtualBox
    3D Objects
    Contacts
    Desktop
    Documents
    Downloads
    Favorites
    Links
    Music
    OneDrive
    Pictures
    SampleFile.txt
    Saved Games
    Searches
    Videos
    
    C:\Users\winuser>
    Thanks will try it exactly as you said.....if I right click on a folder holding Shift down its meant to give an option to open command prompt with that folder, but only see powershell, is there a command like you gave but foe power shell ?
    thanks
      My Computer


  8. Posts : 3,278
    Win10
       #8

    Enter just the word cmd in the explorer address bar to get the command box, or add "Open command window here" context menu using the following tutorial.

    Open command window here - Add in Windows 10

    Either of them will open a command box at that folder location.
    Last edited by das10; 29 Jun 2019 at 11:23.
      My Computers


  9. Posts : 582
    Windows 10 Home
       #9

    Open the folder in Powershell, type or paste the following, press "Enter" and it should put a "filelist.txt" file on your desktop.

    cmd /c dir /b /a-d > "$($env:userprofile)\desktop\filelist.txt"

    Ben
      My Computer


  10. Posts : 989
    Microsoft Windows 10 Home
       #10

    PowerShell:
    Code:
    gci | select name | out-file filelist.txt
    include subdirectories:
    Code:
    gci -recurse | select name | out-file filelist.txt
    include hidden files:
    Code:
    gci -recurse -force | select name | out-file filelist.txt
    Keith
      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 19:06.
Find Us




Windows 10 Forums