Hello friends, using loop file, is there any way to limit how deep it will get into sub-directories ?
example
c:/1/a
c:/1/b
c:/1/c/no
c:/2/a
c:/2/b
c:/2/c/no
What if want to get in only until second level of the folders(a, b, c), avoiding folder "no" for example?
Any tip?
thanks!
loop files Recurse limit levels Topic is solved
Re: loop files Recurse limit levels Topic is solved
Code: Select all
#SingleInstance, Force
Loop, Files, *.*, FR
{
StrReplace(A_LoopFileFullPath, "\", "\", DirCount)
If (DirCount = 3) {
Continue
}
MsgBox, % A_LoopFileLongPath
}
Assuming that your files and directories are setup similar to the list below:
Code: Select all
<DIR> 1\
<FILE> 1\1.txt
<DIR> 1\a\
<FILE> 1\a\a.txt
<DIR> 1\b\
<FILE> 1\b\b.txt
<DIR> 1\c\
<FILE> 1\c\c.txt
<DIR> 1\c\no\
<FILE> 1\c\no\no.txt
<DIR> 2\
<FILE> 2\2.txt
<DIR> 2\a\
<FILE> 2\a\a.txt
<DIR> 2\b\
<FILE> 2\b\b.txt
<DIR> 2\c\
<FILE> 2\c\c.txt
<DIR> 2\c\no\
<FILE> 2\c\no\no.txt
<FILE> Script_With_File_Loop.ahk
Re: loop files Recurse limit levels
This is the best community ever, thank you,
Who is online
Users browsing this forum: No registered users and 93 guests