Wednesday, December 28, 2016

Get List of all Files in a Folder/Directory using Windows Command Prompt

This is a simple way to get the details of all the files in a folder as a text file list. It can be done by the following steps:

1. Open the windows command prompt. There are many ways to do this. Do any one of the following
    • Press the WINDOWS key along with R key. You will a get a Run window as show below. Type "cmd"  in the window and press enter.
    •  Another way is to click the windows start button at the lower left corner and type "cmd". You will get the result as shown below and then press enter.

2. Once the command prompt window is open, use the change directory command to move to the folder of our interest. Use the command as ' cd <folder location>'. For eg:- cd "E:\Backup\Work". Note that if the folder of interest is in any another drive (than that is shown in the cmd window), you will have to change the drive path using the command '<drivename>: '. For eg:- e: can be used to change the drive path to "Drive E"

3. After you have done this, use the command 'dir > textfilename.txt' to save the file details of that folder into textfilename.txt within the same folder. The steps 2 and 3 are illustrated below.

 Finally the file list will look like this.



No comments:

Post a Comment