I want to do this:
- Check if a certain directory exist on a hard disk ?
- Check if a certain file exist on a hard disk ?
- Get the file name,file date,file time exist in a certain folder on hard disk.
Private Sub cmdExist_Click()
Dim fso As New FileSystemObject
Dim fFolder As Folder
Dim sFolder As String
Dim sFile As String
Dim sInfo As String
sFolder = "I:\Projects"
sFile = sFolder & "\Newt.txt"
Set fFolder = fso.GetFolder("c:"
If fso.FolderExists(sFolder) Then
MsgBox "Folder Exists"
If fso.FileExists(sFile) Then
MsgBox "File Exists"
sInfo = "File Version " & fso.GetFileVersion(sFile) & vbCrLf
MsgBox sInfo
Else
MsgBox "File Does Not Exists"
End If
Else
MsgBox "Folder Does Not Exists"
End If
End Sub
You will need to add a reference to the Microsoft Scripting Runtime Library. Hope this Helps. Anything is possible, the problem is I only have one lifetime.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.