\'kontrollere om en mappe slettet Public Function ChkFilePath(Path As String) As String On Error Resume Next If Dir(Path, vbDirectory) <> \"\" Then If (GetAttr(Path) And vbDirectory) = vbDirectory Then ChkFilePath = \"DIR\" Else ChkFilePath = \"FILE\" End If Else ChkFilePath = \"ERROR\" End If End Function
Private Sub Form_Load() Me.Caption = ChkFilePath(\"c:\\autoexec.bat\\ha\\ha\") \'= ERROR Me.Caption = ChkFilePath(\"c:\\autoexec.bat\") \'= FILE Me.Caption = ChkFilePath(\"c:\\windows\\system\") \'= DIR Me.Caption = ChkFilePath(\"c:\\windows\\\") \'= DIR End Sub
Public Function ChkFilePath(Path As String) As String On Error Resume Next If Dir(Path, vbDirectory) <> \"\" Then If (GetAttr(Path) And vbDirectory) = vbDirectory Then ChkFilePath = \"DIR\" Else ChkFilePath = \"FILE\" End If Else ChkFilePath = \"ERROR\" End If End Function
Private Sub Form_Load() If ChkFilePath(\"C:\\Server\") = \"ERROR\" Then MkDir \"C:\\Server\" If ChkFilePath(\"C:\\Server\\BLData$\") = \"ERROR\" Then MkDir \"C:\\Server\\BLData$\" If ChkFilePath(\"C:\\Server\\BLData$\\Database\") = \"ERROR\" Then MkDir \"C:\\Server\\BLData$\\Database\" End Sub
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.