Radar
13 years agoOccasional Contributor
Does Folder Exists
I am attempting to check if a folder exists and if it does not the create.
checkLocation = "C:\\Documents and Settings\\user\\Local Settings\\Temp\\TestComplete\\";
//Check if the location exists
if (!aqFileSystem.GetFolderInfo(checkLocation).Exists)
{
// Creates the folder
createSuccess = aqFileSystem.CreateFolder(checkLocation);
}
The 'TestComplete" sub folder does not exist and I expect to get a result of false.
However, when evaluating the expession 'aqFileSystem.GetFolderInfo(checkLocation).Exists' I get "Unable to open the folder." and thus an exception.
when altering checkLocation variable to 'checkLocation = "C:\\Documents and Settings\\user\\Local Settings\\Temp\\";' the expression evaluates as true.
Can you offer a solution to checking if the folder exists?
Thanks
Mark