Page 1 sur 1

Répertoire est vide

MessagePublié: 31 Oct 2013 à 11:46
par Michael DELIQUE
Code : Tout sélectionner
Public Function DirectoryIsEmpty(Byval wPath As String) As Boolean

   Dim PathFile As String
   
   On Error Goto CatchError
   
   If Trim(wPath) = "" Then
      DirectoryIsEmpty = True
      Exit Function
   End If
   
   If Right(Trim(wPath),1)="\" Then
      PathFile = wPath
   Else
      PathFile = wPath+"\"
   End If
   
   If DirectoryIsValide(PathFile) = False Then
      DirectoryIsEmpty = True
      PathFile = ""
      Exit Function
   End If
   
   PathFile = PathFile+"*.*"
   
   If Trim(Dir$(PathFile)) = "" Then
      DirectoryIsEmpty = True
   Else
      DirectoryIsEmpty = False
   End If
   
   PathFile = ""
   
   Exit Function
CatchError:
   MsgBox "("+Cstr(GetThreadInfo (1))+" Call by "+Cstr(GetThreadInfo(10))+")"+Chr(10)+"Error " + CStr(Err) + " : "+Chr(10) + CStr(Error)+". "+Chr(10)+"Line # "+Cstr(Erl),16," ERROR !"
   DirectoryIsEmpty = False
   Exit Function
End Function