Moses
Moses

Reputation: 1484

Listing folders with absolute paths

I have some subfolders inside a given folder that I would like to list their absolute paths in cmd. Is there a way to go about it?

cd D:\

mkdir Testdir
mkdir TestdirA
mkdir TestdirB

dir Testdir > Testdir\TestdirA\files.txt

dir /B /D

dir /B /S /D Rem This is list the files too.

When I run the code above I do not get the paths but instead the names of the subfolders.

Upvotes: 0

Views: 55

Answers (1)

lit
lit

Reputation: 16256

Unless I misunderstand the question, I think the following will produce what you want. The /A:D switch specifies to list directories only.

DIR /S /B /A:D "C:\Testdir"

Upvotes: 1

Related Questions