Empty directory: Difference between revisions
Content added Content deleted
(added Factor) |
|||
Line 1,086: | Line 1,086: | ||
[ `ls -a $DIR|wc -l` -gt 2 ] && echo $DIR is NOT empty || echo $DIR is empty |
[ `ls -a $DIR|wc -l` -gt 2 ] && echo $DIR is NOT empty || echo $DIR is empty |
||
</lang> |
</lang> |
||
=={{header|VBA}}== |
|||
<lang vb>Sub Main() |
|||
Debug.Print IsEmptyDirectory("C:\Temp") |
|||
Debug.Print IsEmptyDirectory("C:\Temp\") |
|||
End Sub |
|||
Private Function IsEmptyDirectory(D As String) As Boolean |
|||
Dim Sep As String |
|||
Sep = Application.PathSeparator |
|||
D = IIf(Right(D, 1) <> Sep, D & Sep, D) |
|||
IsEmptyDirectory = (Dir(D & "*.*") = "") |
|||
End Function</lang> |
|||
=={{header|VBScript}}== |
=={{header|VBScript}}== |