Solved

Will This piece of code Check to see the directory ex

Posted on 2004-10-05
5
179 Views
Last Modified: 2010-04-23
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
0
Comment
Question by:croag
  • 3
  • 2
5 Comments
 
LVL 1

Author Comment

by:croag
ID: 12232516
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!
0
 
LVL 34

Expert Comment

by:flavo
ID: 12232558
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
0
 
LVL 34

Accepted Solution

by:
flavo earned 50 total points
ID: 12232577
Dim DirInfo As New DirectoryInfo("C:\Temp")
If DirInfo.Exists Then    'Directory Exists
     'You are good to go...
Else
      DirInfo.CreateSubdirectory("C:\Temp")
End If
0
 
LVL 1

Author Comment

by:croag
ID: 12232603
but there are no syntactical errors in the actual code.....how could this be?
0
 
LVL 34

Expert Comment

by:flavo
ID: 12232618
>> 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
0

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question