Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 3 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

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

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
@rsk82: With -maxdepth 1, it isn't. – Dennis Apr 26 '12 at 17:28

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:\=\\%\\/" 
share|improve this answer

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

I wanted to work with a directory listing, so I Googled "Print a Directory". I found instructions to do so, but they included changes to the Registry. Not wanting to diddle with this, and wanting to use a listing, not print it, I found a way to meet my goals without changing the Registry. I created two batch file programs to be saved in a Utility Directory. Then, when I wanted to print or work with a directory, I just copy the appropriate batch file into the subject directory, then execute it! Here they are:

rem PrintThisDirectory.bat
rem Prints the directory where it resides
@echo off
dir %1/-p/o:gn> "%temp%\listing"
start /w notepad "%temp%\listing"

Rem ShowThisDirectory.bat
Rem Displays in Notepad the Directory where it resides
@echo off
dir %1/o:gn> "%temp%\listing"
start /w notepad "%temp%\listing"
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .