Skip to main content

AccessTr.neT


Salt Okunur Dosyaları, Gizli Dosyaları, Sistem Dosyalarını Eklemek

Salt Okunur Dosyaları, Gizli Dosyaları, Sistem Dosyalarını Eklemek

Çözüldü #1
File Exists fonksiyonunu kullanırken Salt Okunur Dosyaları, Gizli Dosyaları, Sistem Dosyalarını da kontrol etmesi için ne yapmalıyız
@benbendedeilem
Cevapla
#2
(21/05/2020, 08:10)accessman yazdı: File Exists fonksiyonunu kullanırken Salt Okunur Dosyaları, Gizli Dosyaları, Sistem Dosyalarını da kontrol etmesi için ne yapmalıyız


Hangi fonksiyondan bahsediyoruz? Fonksiyonu yazınız.
Cevapla
#3
Public Function FileExists(ByVal strFile As String, Optional bFindFolders As Boolean) As Boolean
    Dim lngAttributes As Long

    If bFindFolders Then
        lngAttributes = (lngAttributes Or vbDirectory) 'Include folders as well.
    Else
        'Strip any trailing slash, so Dir does not look inside the folder.
        Do While Right$(strFile, 1) = "\"
            strFile = Left$(strFile, Len(strFile) - 1)
        Loop
    End If

    'If Dir() returns something, the file exists.
    On Error Resume Next
    FileExists = (Len(Dir(strFile, lngAttributes)) > 0)
End Function
@benbendedeilem
Cevapla
#4
Function FileExists(ByVal strFile As String, Optional bFindFolders As Boolean) As Boolean

    Dim lngAttributes As Long

    lngAttributes = (vbReadOnly Or vbHidden Or vbSystem)

    If bFindFolders Then
        lngAttributes = (lngAttributes Or vbDirectory)
    Else

        Do While Right$(strFile, 1) = "\"
            strFile = Left$(strFile, Len(strFile) - 1)
        Loop
    End If

    On Error Resume Next
    FileExists = (Len(Dir(strFile, lngAttributes)) > 0)
End Function
Cevapla
#5
teşekkürler
@benbendedeilem
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da