views:

23

answers:

1

dir /S /aH doesnt work as it wont delve any deeper inside of unhidden folders.

EDIT: turns out it WAS dir /S /aH just there wasnt any hidden or system files or folders within the non hidden files or folders i was testing on.

+1  A: 

This is problematic and the only way I know to solve it is ugly and will give you the result in a "function":

@echo off
setlocal ENABLEEXTENSIONS
goto main

:EnumAllFiles 
FOR /F "tokens=*" %%A IN ('dir /B /S /A:-D-H "%~1" 2^>nul') DO call :%2 "%%~A"
FOR /F "tokens=*" %%A IN ('dir /B /S /A:-DH "%~1" 2^>nul') DO call :%2 "%%~A"
goto :EOF

:mycallback
echo file=%~1
goto :EOF

:main
call :EnumAllFiles "c:\someDirToSearch" mycallback

(This does not tell the mycallback function about folders since you said you wanted files)

Edit: It seems like dir /B /S /a-D also works

Anders
turns out it WAS dir /S /aH just there wasnt any hidden or system files or folders within the non hidden files or folders i was testing on.
Ryan The Leach