开发者

How can i list all hidden files inside all subdirectories using batch scripting for windows XP?

开发者 https://www.devze.com 2023-01-07 15:13 出处:网络
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

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 testi开发者_运维技巧ng on.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消