Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

(In Windows/Command line) I'd like to generate a list of all files, and for each file, I also want the full path displayed.

So if you were doing a directory listing of the folder c:\users\me and it had the files a.txt, b.txt and c.txt, I'd want the following output:

...
c:\users\me\a.txt
c:\users\me\b.txt
c:\users\me\c.txt
...

Can anyone suggest a tool that does this, or do I have to actually go code this?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

As long as the directory doesn't have more directories in it, using the recurse option /s along with bare format /b will show the entire path with files:

dir /s /b

if there are more folders though it will display all the files in there as well. It's a neat little workaround though.

share|improve this answer
    
thanks!!!!!!!!!!!!!!!! that is exactly what I was looking for (I know about /s, I didn't realize /b would be useful here) thanks! –  dplante Sep 25 '09 at 6:17

You can also use the for command, although it's a little more verbose:

for %x in (*) do @echo %~fx

The %~fx tells cmd to output a full path here.

forfiles also works here:

forfiles /c "cmd /c echo @path"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.