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.

Somehow like dir /b command but I need also hidden and system files there. Built in dir command doesn't allow to list such 'hidden' files with the rest and I must use /s to have full path in there, which is of course non recursive.

I also played with windows version of ls command and there also no luck. To display full path you must add asterisk (mydir\*) at the end of directory you are listing, but this makes it recursive.

share|improve this question
    
I can solve part of your problem: the /a flag makes dir include hidden and system files. –  Harry Johnston Apr 30 '12 at 1:32
add comment

5 Answers

up vote 2 down vote accepted

If you don't want to install anything, you could also use the following command:

for /f "delims=" %a in ('cd') do @for /f %b in ('dir /b /a') do @echo %a\%b

You have to cd into the directory first or it won't work.

share|improve this answer
    
or this! for /f "delims=" %b in ('dir /b /a') do @echo %cd%\%b But yours is an interesting technique, quite generic –  barlop May 10 '12 at 6:57
add comment

Try the following command:

dir /s /b /a

It will give ALL files, you can run it through FIND if you want or add a folder name.

share|improve this answer
    
This one worked for me. Thanks. –  Marcelo Sep 18 '12 at 19:09
add comment

If you tried ls, why not just install cygwin? You can use find in cygwin:

find -name "*"

If you do install cygwin and want to use find in cygwin, make sure the find in cygwin is called by either using full path or insert cygwin bin path before system32 because Windows also has a find.exe.

share|improve this answer
    
i checked unixutils, find is recursive :( –  rsk82 Apr 26 '12 at 17:28
2  
@rsk82: With -maxdepth 1, it isn't. –  Dennis Apr 26 '12 at 17:28
add comment

you could download sed with gnuwin32. This prepends the current directory.

Doing %cd% doesn't work.. so %cd:\=\\% converts every \ to \\, which results in \.

C:\WINDOWS>dir /b | sed "s/^/%cd:\=\\%\\/" 
C:\WINDOWS\0.log
C:\WINDOWS\003109_.tmp
C:\WINDOWS\addins
share|improve this answer
add comment

This is an old question, but I thought I'd add something anyhow.

DIR doesn't traverse correctly all the directory trees you want, in particular not the ones on C:. It simply gives up in places because of different protections.

ATTRIB works much better, because it finds more. (Why this difference? Why would MS make one utility work one way and another work different in this respect? Damned if I know.) In my experience the most effective way to handle this, although it's a kludge, is to get two listings:

attrib /s /d C:\ >%TEMP%\C-with-directories.txt

attrib /s C:\ >%TEMP%\C-without-directories.txt

and get the difference between them. That difference is the directories on C: (except the ones that are too well hidden). For C:, I'd usually do this running as administrator.

share|improve this answer
add comment

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.