#get current working directory
os.getcwd()
#trim till directory you want the resource till and get 0th from split
os.getcwd().split(dir_in_str)[0]
#list files and dirs inside dir
os.listdir(dir_in_str)
#append environment independent path seperator
path = path + f'{os.path.sep}'
#search if string is present or endswith in path
if str in path: