How Do I Export Text File

Page 1 of 3 123 LastLast

  1. Posts : 166
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
       #1

    How Do I Export Text File


    Using a cmd prompt, how do I export to my desktop a text file which list only the filename, type and location of all mp3 files on my computer?

    How would I export to my desktop the same thing but listing what is on an external drive or a usb flashdrive?

    How about a txt file which list all mp3 in a folders without reflecting the filepath?

    Also, How would I export a txt file listing all mp3 files inside a certain folder and subfolders?
      My Computer


  2. Posts : 1,784
    Linux Mint 18.2 xfce 64-bit (VMWare host) / Windows 8.1 Pro 32-bit (VMWare guest)
       #2

    Type this command in the command prompt window:

    dir c:\*.mp3 /s > c:\filelist.txt

    This will do a directory listing on your entire C: drive, including all subdirectories, for all files which have .mp3 as their extension. It will direct the output of the command into a text file, c:\filelist.txt. Change the last part -- c:\filelist.txt -- to reflect the filename you want, in the subdirectory you want.

    To do the same thing for your external drive or flashdrive, replace C: with whatever drive letter is used for that device.

    I don't recall the switch you would use to get the filenames without the paths included, but I think it is /b. Go to a command prompt and type dir /? to get all of the information and options for the dir command.

    If the switch is /b, then the above command would be changed as follows:

    dir c:\*.mp3 /s /b > c:\filelist.txt

    The /s switch tells it to do all subdirectories.

    To get the listing for a certain folder and subfolders, let's say C:\My Music, do it like this:

    dir "C:\My Music\*.mp3" /s > c:\filelist.txt
      My Computer


  3. Posts : 166
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
    Thread Starter
       #3

    What would be the cmdlet to have no more than one file name on one line in the text file?

    If I have 20 files in a folder on the desktop and a subfolder containing an additional 20 files, I would like to have the exported text file use 20 lines listing all the files in the folder and 20 other lines for the subfolder.
      My Computer


  4. Posts : 2,774
    Windows 7 Professional 64-bit
       #4

    I think the batch file will list one file one line - unless the full directory of each file is asked for. It has been a long while since I made and used batch-files.
      My Computer


  5. Posts : 166
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
    Thread Starter
       #5

    RolandJS said:
    I think the batch file will list one file one line - unless the full directory of each file is asked for. It has been a long while since I made and used batch-files.
    That is true.

    I believe batch files use PowerShell. I have no problem using PowerShell, it's just I prefer using cmd.exe (Admin)
      My Computer


  6. Posts : 166
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
    Thread Starter
       #6

    How do I get the exported text file to not show the date, time and size of the files?
    I only want the path and filename in alphabetical order one file for one line.

    If I must settle with showing the date, time, and size, how can i have the filename to the far left and the rest after the filename?

    ok, it is exporting a text file.

    Code:
    dir c:\Users\Wyatt\Desktop\*.mp3 /a /s list sortorder N > c:\Users\Wyatt\Desktop\MP3s.txt
    When I open the file it shows one line one file.

    Code:
    Directory of [folder path]
    
    date [tab] time [tab] size [tab] filename
    date [tab] time [tab] size [tab] filename
    date [tab] time [tab] size [tab] filename
    
    Directory of [folder path]
    
    date [tab] time [tab] size [tab] filename
    date [tab] time [tab] size [tab] filename
    date [tab] time [tab] size [tab] filename
    I would like for it to look like this...

    Code:
    Directory of [folder path]
    
    filename
    filename
    filename
    or...

    Code:
    Directory of [folder path]
    
    filename [tab] Date [tab] Size
    filename [tab] Date [tab] Size
    filename [tab] Date [tab] Size
    As long as the filenames are to the far left
    Last edited by WyattWhiteEagle; 10 Jan 2020 at 00:47.
      My Computer


  7. Posts : 72,036
    64-bit Windows 11 Pro for Workstations
       #7

    Hello Wyatt,

    You could also use the command below to list the files in individual lines per directory.

    dir c:\*.mp3 /s /o:gn > %UserProfile%\Desktop\filelist.txt

    How Do I Export Text File-dir.jpg
      My Computer


  8. Posts : 166
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
    Thread Starter
       #8

    Brink said:
    Hello Wyatt,

    You could also use the command below to list the files in individual lines per directory.

    dir c:\*.mp3 /s /o:gn > %UserProfile%\Desktop\filelist.txt

    How Do I Export Text File-dir.jpg
    Thank you so very much. I tweaked that a little...

    dir %UserProfile%\Desktop\*.mp3 /s /o:gn > %UserProfile%\Desktop\MP3s.txt

    The resulting export shows the filenames after the Date/Time and size.

    Is it possible to create the export showing the full filenames before the Date/Time and size?
      My Computer


  9. Posts : 72,036
    64-bit Windows 11 Pro for Workstations
       #9

    I'm not sure how without the filenames being on the same line instead of separate, or only a list of full file paths per separate line without date/time/size.
      My Computer


  10. Posts : 166
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
    Thread Starter
       #10

    Brink said:
    I'm not sure how without the filenames being on the same line instead of separate, or only a list of full file paths per separate line without date/time/size.
    Now I'm curious how the resulting export would display what you mention. May I have those codes to see if something like that is closer to what I'm looking for?
      My Computer


 
Page 1 of 3 123 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

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