Copy folder sub directories / files name to a notepad

There are situations we need to get all the sub folders and files details to a note pad, to achieve this we can use windows command prompt

  • Navigate to the folder that you want to create a list for

E.g – I want to get the list of folders / files under my C:\Root folder

  • Hold SHIFT + Right click and select “Open command window here”
  • Enter following command

C:\Root>dir /a /-p /o:gen >list.txt

 

  • Now navigate the Root folder and find a new text file created as list.txt, open and get the all the sub folders / files details

——————————————————

Volume in drive C is Windows
Volume Serial Number is 80D8-BE7F

Directory of C:\Root

04/25/2017 06:42 PM <DIR>   .
04/25/2017 06:42 PM <DIR>   ..
04/25/2017 06:37 PM <DIR>   Adv
04/25/2017 06:37 PM <DIR>  Baisc
04/25/2017 06:37 PM           0 MyDet.docx
04/25/2017 06:37 PM           0 Cmd1.txt
04/25/2017 06:42 PM           0 list.txt
04/25/2017 06:37 PM           0 test.txt
4 File(s) 0 bytes
4 Dir(s) 301,075,058,688 bytes free

—————————————————

If you want only list of files (no extra information), then open cmd and type

C:\Root>dir /a /b /-p /o:gen >list.txt

——————————————————

Volume in drive C is Windows
Volume Serial Number is 80D8-BE7F

Directory of C:\Root

Adv
Baisc
MyDet.docx
Cmd1.txt
list.txt
test.txt

————————-

NOTE:

“dir” command will list all the folders and files under specified folder.

“>” operator will redirect the result of command to the specified text file

open cmd and enter dir /? to see all available options and their explanation.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *