Add folder above current working folder folder using iLogic

Add folder above current working folder folder using iLogic

Daniel_Gerssen
Participant Participant
281 Views
1 Reply
Message 1 of 2

Add folder above current working folder folder using iLogic

Daniel_Gerssen
Participant
Participant

I want to create a folder \Export in the folder above my current working directory.

How do I manipulate the path in order to go one folder up.

For example: C:\path\Drawings\Inventor

to:

C:\path\Drawings\Export

 

 

	Dim oPath As String = System.IO.Path.GetDirectoryName(oDoc.FullFileName)	
	Dim oFolder As String = oPath & "\Export"
	If Not System.IO.Directory.Exists(oFolder) Then
	    System.IO.Directory.CreateDirectory(oFolder)
	End If

 

0 Likes
Accepted solutions (1)
282 Views
1 Reply
Reply (1)
Message 2 of 2

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @Daniel_Gerssen 

 

Give this a try:

 

Imports System.IO 
Dim oFolder As String = System.IO.Path.GetDirectoryName(ThisDoc.Document.FullFileName)
Dim oParentFolder = Directory.GetParent(oFolder).FullName

Dim oNewFolder As String = oParentFolder & "\Export"
If Not System.IO.Directory.Exists(oNewFolder) Then
	System.IO.Directory.CreateDirectory(oNewFolder)
End If

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes