Dir Function

αžαŸ’αžšαž‘αž”αŸ‹β€‹αžˆαŸ’αž˜αŸ„αŸ‡β€‹αž“αŸƒβ€‹αž―αž€αžŸαžΆαžšβ€‹αž˜αž½αž™ αžαžβ€‹αž˜αž½αž™ αž¬β€‹αž―αž€αžŸαžΆαžš αž“αž·αž„β€‹αžαžβ€‹αž‘αžΆαŸ†αž„αž’αžŸαŸ‹β€‹αž›αžΎβ€‹αžŠαŸ’αžšαžΆαž™ αž¬β€‹αž€αŸ’αž“αž»αž„β€‹αžαžβ€‹αžŠαŸ‚αž›β€‹αž•αŸ’αž‚αžΌαž•αŸ’αž‚αž„β€‹αž•αŸ’αž›αžΌαžœβ€‹αžŸαŸ’αžœαŸ‚αž„αžšαž€β€‹αžŠαŸ‚αž›β€‹αž”αžΆαž“β€‹αž”αž‰αŸ’αž‡αžΆαž€αŸ‹β€‹Β αŸ”

αžœαžΆαž€αŸ’αž™β€‹αžŸαž˜αŸ’αž–αž“αŸ’αž’ αŸ–


Dir [(Text As String) [, Attrib As Integer]]

αžαž˜αŸ’αž›αŸƒβ€‹αžαŸ’αžšαž‘αž”αŸ‹ αŸ–

αžαŸ’αžŸαŸ‚β€‹αž’αž€αŸ’αžŸαžš

αž”αŸ‰αžΆαžšαŸ‰αžΆαž˜αŸ‰αŸ‚αžαŸ’αžš αŸ–

Text αŸ– αž€αž“αŸ’αžŸαŸ„αž˜β€‹αžαŸ’αžŸαŸ‚β€‹αž’αž€αŸ’αžŸαžšβ€‹αžŽαžΆβ€‹αž˜αž½αž™ αžŠαŸ‚αž›β€‹αž”αž‰αŸ’αž‡αžΆαž€αŸ‹β€‹β€‹αž›αž˜αŸ’αž’αž·αžβ€‹αž–αžΈβ€‹αž•αŸ’αž›αžΌαžœβ€‹αžŸαŸ’αžœαŸ‚αž„αžšαž€ ថត αž¬β€‹αž―αž€αžŸαžΆαžšΒ αŸ” αž’αžΆαž‚αž»αž™αž˜αŸ‰αž„αŸ‹β€‹αž“αŸαŸ‡β€‹αž’αžΆαž…β€‹αžαŸ’αžšαžΌαžœβ€‹αž”αžΆαž“β€‹αž”αž‰αŸ’αž‡αžΆαž€αŸ‹β€‹β€‹β€‹αžαŸ‚β€‹αž–αŸαž›β€‹αžŠαŸ†αž”αžΌαž„ αžŠαŸ‚αž›β€‹αž’αŸ’αž“αž€β€‹αž αŸ…β€‹αž’αž“αž»αž‚αž˜αž“αŸ DirΒ αŸ” αž”αŸ’αžšαžŸαž·αž“β€‹αž”αžΎβ€‹αž’αŸ’αž“αž€β€‹αž…αž„αŸ‹ αž’αŸ’αž“αž€β€‹αž’αžΆαž…β€‹αž”αž‰αŸ’αž…αžΌαž›β€‹αž•αŸ’αž›αžΌαžœβ€‹αž€αŸ’αž“αž»αž„ αž€αŸ†αžŽαžαŸ‹ URL αŸ”

Attrib αŸ– αž€αž“αŸ’αžŸαŸ„αž˜β€‹αž…αŸ†αž“αž½αž“β€‹αž‚αžαŸ‹β€‹αžŽαžΆβ€‹αž˜αž½αž™ αžŠαŸ‚αž›β€‹αž”αž‰αŸ’αž‡αžΆαž€αŸ‹β€‹β€‹αž‚αž»αžŽβ€‹αž›αž€αŸ’αžαžŽαŸˆβ€‹αž―αž€αžŸαžΆαžš bitwiseΒ αŸ” αž’αž“αž»αž‚αž˜αž“αŸ Dir αžαŸ’αžšαž‘αž”αŸ‹β€‹αžαŸ‚β€‹αž―αž€αžŸαžΆαžš αž¬β€‹αžαžβ€‹αžŠαŸ‚αž›β€‹αž•αŸ’αž‚αžΌαž•αŸ’αž‚αž„β€‹αž‚αž»αžŽβ€‹αž›αž€αŸ’αžαžŽαŸˆβ€‹αžŠαŸ‚αž›β€‹αž”αžΆαž“β€‹αž”αž‰αŸ’αž‡αžΆαž€αŸ‹β€‹Β αŸ” αž’αŸ’αž“αž€β€‹αž’αžΆαž…β€‹αž•αŸ’αžŸαŸ†β€‹αž‚αž»αžŽβ€‹αž›αž€αŸ’αžαžŽαŸˆβ€‹αž‡αžΆβ€‹αž…αŸ’αžšαžΎαž“β€‹αžŠαŸ„αž™β€‹αž”αž“αŸ’αžαŸ‚αž˜β€‹αžαž˜αŸ’αž›αŸƒβ€‹αž‚αž»αžŽβ€‹αž›αž€αŸ’αžαžŽαŸˆ αŸ–

0 αŸ– αž―αž€αžŸαžΆαžšβ€‹αž’αž˜αŸ’αž˜αžαžΆΒ αŸ”

16 αŸ– αžαŸ’αžšαž‘αž”αŸ‹β€‹αžαŸ‚β€‹αžˆαŸ’αž˜αŸ„αŸ‡β€‹αž“αŸƒβ€‹αžαžβ€‹αž”αŸ‰αž»αžŽαŸ’αžŽαŸ„αŸ‡Β αŸ”

αž”αŸ’αžšαžΎβ€‹αž‚αž»αžŽβ€‹αž›αž€αŸ’αžαžŽαŸˆβ€‹αž“αŸαŸ‡β€‹αžŠαžΎαž˜αŸ’αž”αžΈβ€‹αž–αž·αž“αž·αžαŸ’αž™β€‹αž˜αžΎαž›β€‹αž”αŸ’αžšαžŸαž·αž“β€‹αž”αžΎβ€‹αž˜αžΆαž“β€‹αž―αž€αžŸαžΆαžš αž¬β€‹αžαž αž¬β€‹αžŠαžΎαž˜αŸ’αž”αžΈβ€‹αž€αŸ†αžŽαžαŸ‹β€‹αž―αž€αžŸαžΆαžš αž“αž·αž„β€‹αžαžβ€‹αž‘αžΆαŸ†αž„αž’αžŸαŸ‹β€‹αž€αŸ’αž“αž»αž„β€‹αžαžβ€‹αžŠαŸ‚αž›β€‹αž”αžΆαž“β€‹αž”αž‰αŸ’αž‡αžΆαž€αŸ‹Β αŸ”

β€‹αž–αž·αž“αž·αžαŸ’αž™β€‹αž˜αžΎαž›β€‹ αž”αŸ’αžšαžŸαž·αž“β€‹αž”αžΎβ€‹αž˜αžΆαž“β€‹αž―αž€αžŸαžΆαžšβ€‹αž˜αž½αž™β€‹ αž”αž‰αŸ’αž…αžΌαž›β€‹αž•αŸ’αž›αžΌαžœβ€‹αž–αŸαž‰β€‹αž›αŸαž‰ αž“αž·αž„β€‹αžˆαŸ’αž˜αŸ„αŸ‡β€‹αžšαž”αžŸαŸ‹β€‹β€‹αž―αž€αžŸαžΆαžšΒ αŸ” αž”αŸ’αžšαžŸαž·αž“β€‹αž”αžΎαž‚αŸ’αž˜αžΆαž“β€‹β€‹αžˆαŸ’αž˜αŸ„αŸ‡β€‹αž―αž€αžŸαžΆαžš αž¬β€‹αžαž αž’αž“αž»αž‚αž˜αž“αŸ Dir αžαŸ’αžšαž‘αž”αŸ‹β€‹αžαŸ’αžŸαŸ‚β€‹αž’αž€αŸ’αžŸαžšβ€‹αž”αŸ’αžšαžœαŸ‚αž„β€‹αžŸαžΌαž“αŸ’αž™ ("")Β αŸ”

To generate a list of all existing files in a specific directory, proceed as follows: The first time you call the Dir function, specify the complete search path for the files, for example, "D:\Files\*.ods". If the path is correct and the search finds at least one file, the Dir function returns the name of the first file that matches the search path. To return additional file names that match the path, call Dir again, but with no arguments.

To return directories only, use the attribute parameter. The same applies if you want to determine the name of a volume (for example, a hard drive partition).

Error codes:

5 αž€αžΆαžšβ€‹αž αŸ…β€‹αž”αŸ‚αž”αž”αž‘β€‹αž˜αž·αž“β€‹αžαŸ’αžšαžΉαž˜αžαŸ’αžšαžΌαžœ

53 αžšαž€β€‹αž˜αž·αž“β€‹αžƒαžΎαž‰β€‹αž―αž€αžŸαžΆαžš

αž§αž‘αžΆαž αžšαžŽαŸ αŸ–


Sub ExampleDir
REM Displays all files and directories
Dim sPath As String
Dim sDir As String, sValue As String
    sDir="Directories:"
    sPath = CurDir
    sValue = Dir$(sPath + getPathSeparator + "*",16)
    Do
        If sValue <> "." And sValue <> ".." Then
            If (GetAttr( sPath + getPathSeparator + sValue) And 16) >0 Then
                REM get the directories
                sDir = sDir & chr(13) & sValue
            End If
        End If
        sValue = Dir$
    Loop Until sValue = ""
    MsgBox sDir,0,sPath
End Sub

Please support us!