Link to home
Start Free TrialLog in
Avatar of croag
croagFlag for United States of America

asked on

Will This piece of code Check to see the directory ex

I acutally used a reference from this site but I wanted to make sure and I honesly can't test it right now, Please let me know for an easy 50 pts. Thanks!


Public compiledpxp As String = "c:\cytodata\compiledpxp"
 Public save As String = "c:\cyotodata\save\originalpxp"




   If Not Len(Dir$(compiledpxp, vbDirectory)) > 0 Then
            Len(CObj((Dir$(compiledpxp, vbDirectory))).Createdirectory(compiledpxp))
        ElseIf Len(Dir$(save, vbDirectory)) > 0 Then
            Len(CObj((Dir$(save, vbDirectory))).Createdirectory(compiledpxp))
        End If
Avatar of croag
croag
Flag of United States of America image

ASKER

I should say - Will that little sniplet check if the given directories exsists, and if not, create them? If not, can you let me know where I'm going wrong? Thank you so much!
It looks like Vb 6.0 to me

heres a .Net version that does the same thing

    Dim finfo As New System.IO.FileInfo("C:\temp\mydocuments\mfile.exe")
        Dim dir As System.IO.DirectoryInfo = finfo.Directory
        If Not dir.Exists Then
            dir.Create()
            MessageBox.Show("Directory created")
        Else
            MessageBox.Show("Directory exists")
        End If
ASKER CERTIFIED SOLUTION
Avatar of flavo
flavo
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of croag

ASKER

but there are no syntactical errors in the actual code.....how could this be?
>> syntactical errors

Thats not the be all and end all.  There can be other reasons that will cause it not to work.  How did the code go that I posted