Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. Create a text file listing of the files
  2.  
  3. The output can be sent to a text file by using the redirection symbol “>” (no quotes).
  4.  
  5. Open the command line at the folder of interest.
  6. Enter “dir > listmyfolder.txt” (without quotes) to list the files and folders contained in the folder.
  7. If you want to list the files in all the subfolders as well as the main folder, enter “dir /s >listmyfolder.txt” (without quotes)
  8. The file "listmyfolder.txt" will be created automatically in the working folder. (Of course, you can use any name you choose but it is best to keep the extension .txt.) The list can be kept for reference and printed if desired. The list does not have to be placed in the working folder. Give the full pathname to create the file elsewhere. For example, “dir >F:\listmyfolder.txt” could be used to place the list on an external drive F:
  9.  
  10. Create a text file listing only certain types of files
  11.  
  12. Rather than listing all the files in a folder, you may desire a list of certain types such as pictures or music. The dir command allows the use of the wildcard symbol *, which adds very useful functionality. Here are some examples.
  13.  
  14. List all the MP3 files in a folder and its subfolders
  15.  
  16. The command becomes:
  17.  
  18. dir /s *.mp3 >listmp3.txt
  19. This creates a list of MP3 files only.
  20.  
  21. List all the JPEG pictures in a folder and its subfolders
  22.  
  23. The command becomes:
  24.  
  25. dir /s *.jpg >listjpg.txt
  26. This creates a list of JPEG files only.
  27.  
  28. A simpler format
  29.  
  30. The commands as written will make lists that include information about files such as size and date of creation. A simpler list containing only file names (with full path) can be obtained with the switch "/b". An example command would be:
  31.  
  32. dir /s/b *.jpg >listjpg.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement