Generate File Listing of a Directory

Consider a case, where you have mp3 songs of 1000s Movies or even 1000+ Movies in one single folder. And you want a list of that directory so that it can be sent to a friend. Here we will be generating a text file listing the files and folders, which can be easily edited / printed. There are many FREEWARE tools available for the purpose, but it’s always interesting to do it yourself. First create a batch file. Open Notepad and type the following in it

dir /a /-p /o:gen >filelist.txt

save the file with name (let) “filelistgenerator.bat” . Now in order to generate listing of a particular directory, simply put the file in that directory and execute it. It will generate the output as follows.Folder View

File List Before

But even copying the batch file every time seems a tiring job. It’ll be easier if somehow we can integrate it with Windows Right Click Context Menu.

  • Press Windows+R (Run) and type regedit (Registory Editor)
  • Go to ComputerHKEY_CLASSES_ROOTDirectoryBackgroundshell
  • Right click on ‘shell’ >>new>>key
  • Give it any name (let) GenerateFileList
  • Right click on GenerateFileList >>new>>key
  • Name it ‘command’ (all small)
  • Inside command, double click the default string and put the value data as “C:Windowsfilelistgenerator.bat” i.e. permanent path of your batch file
  • Now simply right click inside the folder you want to be directory listed. And select GenerateFileList.

Registry Editor

Right Click

File List After


This batch file will generate directory listing in verbose mode, i.e. will all the info. In case one wants ONLY the directory listing

Edit the batch file and add one more parameter /b to it

dir /a /b /-p /o:gen >filelist.txt
Tagged , , ,