Method FindFolderByPath
FindFolderByPath(string)
Finds a folder by its path, which can be specified as either an absolute path (e.g., "MyProject/Folders/Folder1") or a relative path (e.g., "./Folder1" to find Folder1 in the same directory as the script using this API).
Declaration
IFolder FindFolderByPath(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | The path of the folder, either absolute or relative. |
Returns
Type | Description |
---|---|
IFolder | The folder at the specified path, or null if not found. It is important to note that this method could return null if the folder is not located. |
Examples
Using an absolute path:
var folder = api.FindFolderByPath("MyProject/Folders/Folder1");
if (folder != null)
{
Console.WriteLine("Folder found!");
}
else
{
Console.WriteLine("Folder not found.");
}
Using a relative path:
var folder = api.FindFolderByPath("./Folder1");
if (folder != null)
{
Console.WriteLine("Folder found in the current directory!");
}
else
{
Console.WriteLine("Folder not found in the current directory.");
}