|
-
Jul 26th, 2005, 08:22 AM
#1
Thread Starter
Lively Member
[RESOLVED] File exist?
What code do I use to check if a file exists, and to check that the file is not a blank file (e.g. 0kb in size)?
Cheers
-
Jul 26th, 2005, 08:27 AM
#2
Re: File exist?
Use System.IO.File.Exists() and System.IO.FileInfo.
-
Jul 26th, 2005, 08:30 AM
#3
Thread Starter
Lively Member
Re: [RESOLVED] File exist?
Perfect
-
Jul 26th, 2005, 08:33 AM
#4
Member
Re: [RESOLVED] File exist?
you could do something like this
VB Code:
If System.IO.File.Exists("c:\doc1.doc") Then
System.IO.File.Delete("c:\doc1.doc"))
End If
That will check if c:\doc1.doc exists, if it does, it will delete it.
This might also be useful to you:
VB Code:
If Not (System.IO.Directory.Exists("c:\somefolder")) Then
System.IO.Directory.CreateDirectory("c:\somefolder").Attributes = FileAttributes.Hidden
End If
this checkes if a directory exists, if it does not, it creates it!
-
Jul 26th, 2005, 08:34 AM
#5
Member
Re: [RESOLVED] File exist?
Oops, I think I was a little too late!
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
|