Mr UK
Mr UK

Reputation: 21

How to get list (full path) of files exist in folder and subfolder in cmd

I would like to get the list of files exist in folder and subfolder with full path.Don’t want any blank folder or subfolder path in list.

Example. (File exist on path) ~\Folder1 \Subfolder1 \File1.jpg

(No file on this path, blank folder) ~\Folder2 \Subfolder2\

(File exist on path) ~\Folder3 \Subfolder3 \File3.png

*Result .\Folder1\Subfolder1\File1.jpg .\Folder3\Subfolder3\File3.png

I tried dir /s /b>list.txt command in cmd but also getting path on blank folder path that I don’t want.

Upvotes: 0

Views: 3736

Answers (1)

Wisblade
Wisblade

Reputation: 1644

Simply ask dir to remove directories... Being a directory is considered as an attribute.

dir /s /b /a:-D > list.txt

Upvotes: 1

Related Questions