Sub-Directories Check For Existance And Add If It Doesn't Already Exist

This is a neat little function that checks to see if a declared subdirectory
exists and if is doesn't then it creates it. It assumes that the parent
directory exists, so if in doubt then call the function several times starting
at the root.

This is a useful function if, like me, you want to control the detaching of
documents so that they are placed using script in the same sub directory on all
user's machines
To call the function:

CheckForCreateDirectory("c:\notes\data\attachments")


The Function itself:

Function CheckForCreateDirectory(DirPath As String)
'This function checks for a subdirectory given the parent, and if it doesn't
exist it creates it

'Extract the different elements of the full path
DirName=DirPath
Continue=False
Do While continue=False
If Instr(DirName,"\") Then
DirName=Right(DirName,Len(DirName)-Instr(DirName,"\"))
Else
Continue=True
End If
Loop
ParentDirPath=Left(DirPath,Len(DirPath)-Len(DirName))

'Check for directory and add if it doesn't exits
CheckDir = Dir$(ParentDirPath,16)
CheckDirFlag=False
Do While CheckDir <> ""
If Ucase(CheckDir) = Ucase(DirName) Then
CheckDirFlag = True
End If
CheckDir = Dir$()
Loop
If CheckDirFlag=False Then
Mkdir DirPath
End If
End Function
This was first published in November 2000

Dig deeper on Lotus Notes Domino Administration Tools

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.uk

Close