31 Aug 2011 19:00
Re: for loop including hidden files
On 1/09/2011 02:54, Marc Peterson wrote:
>>> Batch world group,
>>>
>>> Any ideas how to include hidden files in a for loop? Most commands
>> (FOR,
>>> DIR, etc.) exclude hidden files, obviously.
>>>
>>> I thought I was onto a workaround with something like this:
>>> for /f "tokens=2 delims=:" %%I in ('attrib *') do <at> echo %%I
>>
>> Try this:
>>
>> for /f "delims=" %%a in ('dir /b /a:-d ') do <at> echo %%a
>
>
> Oh, wow, I was really over-thinking it and missing the obvious.
>
> Still, though, I don't think I would have found that solution myself because
> I've never fully grasped the /a:-d type switches. I guess it means exclude
> _only_ directories while including all the other DIR attribute options (R,
> H, A,& S).
Yep, precisely.
> Thanks!
Your welcome.
------------------------------------
(Continue reading)
RSS Feed