how to list all files and directories in given directory with full path but not recursive?
Solution 1
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.
Solution 2
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.
Solution 3
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.
Related videos on Youtube
David Barishev
Updated on September 18, 2022Comments
-
David Barishev over 1 year
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. -
David Barishev about 12 yearsi checked unixutils, find is recursive :(
-
barlop about 12 yearsor this! for /f "delims=" %b in ('dir /b /a') do @echo %cd%\%b But yours is an interesting technique, quite generic
-
rubo77 over 5 yearscould you explain please, how this command works?