Using the parent folder would not work. It is set up to cycle through parent folders from the grandparent folder. Are you sure the name of your folder is
2201 and nothing else? No trailing spaces or something?
I tested it here and it works. In the folder where the script resides, I have a folder named
private, and inside that I have one named
records, and inside that folder, I have a folder named
1601 - 1700, and inside that I have one named
1650. When I run the code below and input 1650, it opens a File Explorer window to the 1650 directory. If I enter something else, it tells me it's not found.
Code: Select all
F3::
InputBox, Folder, Enter Folder
loop, Files, private\records\*, D
{
loop, Files, %A_LoopFileFullPath%\*, D
{
if (A_LoopFileName = Folder) {
Run, % A_LoopFileFullPath ; only gets here if it's the actual desired folder
return ; stop looking and return
}
}
}
MsgBox Folder %folder% not found! ; only gets here if the path was never found above
return
Make sure that your path is correct and actually cycling through parent folders by running this version that will show a MsgBox for each parent folder it finds:
Code: Select all
F3::
InputBox, Folder, Enter Folder
loop, Files, \\xxxx\shared\Departments\xxxx\xxxx\Team\xxxx\yyyy\zzzz\*, D ;filepath is anonimised but this is grandparent folder
{
MsgBox, % "Checking parent folder:`n`n" A_LoopFileFullPath
if InStr(FileExist(A_LoopFileFullPath "\" Folder), "D") {
Run, % A_LoopFileFullPath "\" Folder
return ; stop looking and return
}
}
MsgBox Folder %folder% not found! ; only gets here if the path was never found above
return
When running this version, does it show any MsgBox messages with "Checking parent folder: ..."? Does it show the one that contains the folder you asked it to find?