Create a list of all folders in a directory using the Windows command prompt. Use this inventory of existing folders and files to restructure your shared drive or target ROT (Redundant, Obsolete, and Transitory records) for deletion. Knowing what you have is the first step in identifying obsolete, overly-nested, or poorly-named folders and files. The RMS ROT Squad recommends taking a volume measurement before and after a cleanup project to demonstrate your success.  

Steps

Open File Explorer in Windows. Navigate to the directory containing the folders you wish to appear in your list.

 

Click in the address bar and replace the file path by typing cmd then press Enter.

This should open a black and white command prompt displaying the above file path.

Type dir /A:D /B > FolderList.txt and press Enter to generate a top-level folder list. When the list is complete, a new, blank prompt with a flashing cursor will appear.

  • Substitute dir /B > FolderList.txt to include files as well as folders.
  • Substitute dir /A:D /B /S > FolderList.txt to produce a list of all folders and all subfolders of the directory.  WARNING: This can take a while if you have a large directory. Be patient and do not close the command prompt window until it finishes and a new, blank prompt with a flashing cursor appears again.

There should now be a new text file called FolderList in the above directory.

Close the command prompt window and return to File Explorer.

Double-click that file to open it in Notepad to view a list of folders in that directory.

Copy the contents into a Word document or Excel spreadsheet to add columns or further format.

Notes

  • The command prompt uses an older method of alphabetizing folders; you may need to rearrange some folders in your list in order to match the sort order that appears in File Explorer.  
  • When you type the command into the command prompt, you can change the output file name to whatever you like but you must include the .txt at the end.