VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Check if File Exists Including Hidden Files

by Dan Redding - Blue Knot Software (14 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (4 Votes)

Simple function to check if file exists. Detects Normal & Hidden files. Improvement of code from Greg G., and incorporating a suggestion by Larry Rebich.

Inputs
A Valid Pathname as String.
Code Returns
Boolean TRUE if file exists at path specified
Side Effects
Simply returns FALSE if an invalid path is encountered

Rate Check if File Exists Including Hidden Files

Public Function FileExists(strFile as String) As String
 On Error Resume Next 'Doesn't raise error - FileExists will be false
      'if error occurs
 'a valid path would be someting like "C:\Windows\win.ini" - Full path
 'must be specified
 FileExists = Dir(strFile, vbHidden) <> ""
 
End Function

Download this snippet    Add to My Saved Code

Check if File Exists Including Hidden Files Comments

No comments have been posted about Check if File Exists Including Hidden Files. Why not be the first to post a comment about Check if File Exists Including Hidden Files.

Post your comment

Subject:
Message:
0/1000 characters