If you have a large number of files in a folder or distributed in some folders and your goal is to make a list of all the available directories and files. If number of objects (directories and files) are in hundreds, doing it manually is going to take reasonable long time and would surely be annoying.
Suppose we want to make a list of all the files in a folder “Program Files” which is commonly located on our ‘C:’ drives. We take start by opening command prompt. Command Prompt can be accessed wither by searching for it in “All Programs”, going to “RUN” and type ‘cmd’. If you are unable to find “RUN” button in your start menu, it can be opened using “WINDOW-key + R”.
Once you have opened command prompt, traverse to desired folder. Once there, you’ll have to give the statement “dir /s >FileList.txt”.
Below is the complete display how to do it all.
C:\Documents and Settings\Admin>
C:\Documents and Settings\Admin>cd\
C:\>cd “PROGRAM FILES”
C:\Program Files>dir /s >FileList.txt
Line wise description is as under:
- Normally this is the landing path which is opened when command prompt is accessed.
- To get in the root path of our drive we use ‘cd\’
- Now when your present working directory is your drive, you can goto your desired folder easily. Folder name is to be used in inverted commas because complete folder name contains a space inside.
- “dir” is the command that displays contents of a directory, parameter “/s” makes it possible to get info from sub-directories and “FileList.txt” will be the file name where you’ll be able to see your required list. This command may take some time according to the number of files that it has to enlist.