The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 check an existing subfolder
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

billaravi

USA
14 Posts

Posted - 05/18/2005 :  04:03:46 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (7.0):
Operating System:XP PRO

Hi
I have a situation where i need to create sunfolders in a project. But before creating i need to verify if a subfolder already exists by that name, so that i wont be creating duplicates of the subfolder. If the subfolder exists i will activate that folder and do operations with in that and if it does not i will create one. how do i go about doing this ?

cheers
ravi

greg

USA
1379 Posts

Posted - 05/18/2005 :  09:15:27 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Recall that the IsValid() method can be used on many objects, so you could use code like the following:

Folder fld = Project.RootFolder;
Folder fldsub = fld.Subfolders("MyFolder");
if( fldsub.IsValid() )
printf("Found the subfolder of root named 'MyFolder'\n");
else
{
printf("Not found. Creating ...'MyFolder'\n");
fldsub = fld.AddSubfolder("MyFolder");
}


Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000