With a file loop, any way to match multiple extensions?
With a file loop, any way to match multiple extensions?
Hi, old AHK user but I'm kinda rusty and I don't remember if there's a way to do this. Using Loop FilePatern (or Loop Files, FilePatern), is there any way to match multiple file extensions? Like jpg and png for instance. I guess in this particular example I could use ??g, but that's kinda hackish and only works by happy accident. I know there are a couple other options like grabbing all the files and checking their names with my own logic or using separate loops for each extension, but I just wanted to ask if there's a simple way first.
Re: With a file loop, any way to match multiple extensions?
Just do
Code: Select all
Loop, Files, some folder path
{
if (A_LoopFileExt ~= "TXT|EXE|DOC|PNG")
MsgBox % "Match Found: " A_LoopFileLongPath
}
Re: With a file loop, any way to match multiple extensions?
Well that would be an example of "grabbing all the files and checking their names with my own logic", wouldn't it? But I suspected that's what I'd have to do, so thanks for the confirmation.
It's just that I'm dealing with a ridiculous number of files, potentially like half a million, so I want to make this as streamlined as possible. But if that's the best way, that's the best way.
It's just that I'm dealing with a ridiculous number of files, potentially like half a million, so I want to make this as streamlined as possible. But if that's the best way, that's the best way.