|
-
Aug 21st, 2000, 01:32 PM
#1
Thread Starter
Lively Member
This should be an easy question for you guys...
At the beginning of my program, I want to see if a folder exists, and if it does, I want to delete it. Dir() does not seem to be working. It is still drawing a "" when I know the folder exists. This is my code:
If Dir(App.Path & "\temp") <> "" Then RmDir (App.Path & "\temp")
How do I get this to work?
VB6 & VC++6 Pro (SP4), Java (Sun JDK)
-
Aug 21st, 2000, 01:37 PM
#2
Try this:
Code:
If Dir(App.Path & "\temp", vbDirectory) Then
Or you could just try to remove the folder and catch the error if it doesn't exist:
Code:
On Error Resume Next
RmDir App.Path & "\Temp"
Good luck!
-
Aug 21st, 2000, 01:48 PM
#3
Thread Starter
Lively Member
Worked great, Joacim. Thank you.
VB6 & VC++6 Pro (SP4), Java (Sun JDK)
-
Aug 21st, 2000, 01:48 PM
#4
transcendental analytic
Joacim, you get an typemismatch with just a string
Code:
If len(Dir(App.Path & "\temp", vbDirectory)) Then
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 21st, 2000, 01:52 PM
#5
Thread Starter
Lively Member
Kedaman's right. I used
Code:
If Dir(App.Path & "\temp", vbDirectory) <> "" Then
VB6 & VC++6 Pro (SP4), Java (Sun JDK)
-
Aug 21st, 2000, 02:02 PM
#6
Yes of course! This is what's happening when you type the code directly into the post.
-
Aug 21st, 2000, 02:22 PM
#7
transcendental analytic
Hehe, which usually happens to me but obviously it happens to everyone
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|