Solved

Will This piece of code Check to see the directory ex

Posted on 2004-10-05
5
201 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

617 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