Solved

Checking for a Directory and Returning File Info

Posted on 1998-06-21
3
168 Views
Last Modified: 2010-05-03
This is a two part question. First part is easy, second is more difficult.  

First part is...How do I verify if a directory exists and if so do xxxx, if not then create it?

Second part - How do I call or retreive a File's Product Name, Description, and Version Number information into 3 diffrent variables? I know this would only apply to files that had this info, and in this case I would be checking my own exe's.

Thanks in advance
0
Comment
Question by:UpAllNite
3 Comments
 

Accepted Solution

by:
spurssy earned 50 total points
ID: 1463948
you may try these codes...

Dim DirName as String

DirName = "c:\testdir"

if Dir(DirName, vbDirectory) <> "" Then
    'do XXXX
else
    Mkdir DirName
endif

I dun quite understand what you mean for the 2nd part, pls elaborate.
0
 
LVL 1

Expert Comment

by:michelv
ID: 1463949
Well the answer is correct, for a directory that does not exist in one-depth tree, but what if this directory doesn't exist:

C:\Temp\From\Here\Its\a\whole\new\directory

and eg. C:\Temp does exist...

a MkDir "C:\Temp\From\Here\Its\a\whole\new\directory"

won't work here...

You need recursive...

About the info in EXE files, search the web for PE-Header file desciption, there you'll find the answer, if you wan't more info on the above, just comment it and I'll try to answer...


Greetz,

Michel

0
 

Author Comment

by:UpAllNite
ID: 1463950
As far as the second part:  What I need to do is obtain the (Windows Properties Sheet Information) from each file that I specify (FileName,Product Name,File Description, Version Number) and place that in a listview.

File #1: abc.exe,Product Name,File Description,Version Number
File #2: efg.ocx,Product Name,File Description,Version Number
File #3: xyz.dll,Product Name,File Description,Version Number

After that I will loop through the list to process each file based on the information obtained above.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now