I am trying to see if a specific folder exists as a sub folder in a certain path.
Assume a path given in a variable
and a relative path given
How can I write a block to look if a given folder name
(given by a variable
FolderName) exists in that path?
In that path means that if I do
dir in the path
I want to check if
FolderName is one of the folders listed.
dir /d can list only directories,
but I don't know how to search that list.
To make an example by a batch file:
@echo off SET INPUT_PATH="D:\SomeFolder\OtherFolder\RandomFolder\" SET REL_PATH="..\FunnyFolder" SET FOLDER_NAME="SearchMeFolder" goto IsFolder :IsFolder SET CURR_PATH=%CD% cd "%INPUT_PATH%\%REL_PATH%" :: Need to fetch all sub folder and check for existence :: If exist, set FOLDER_EXIST to True, else False