Dir Function

āĻĄā§āϰāĻžāχāĻ­ āĻ…āĻĨāĻŦāĻž āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰāĻŋāϰ āωāĻ˛ā§āϞ⧇āĻ–āĻŋāϤ āĻ…āύ⧁āϏāĻ¨ā§āϧāĻžāύ āĻĒāĻžāĻĨ⧇āϰ āϏāĻžāĻĨ⧇ āĻŽāĻŋāϞ⧇ āϝāĻžā§Ÿ āĻāĻŽāύ āĻāĻ•āϟāĻŋ āĻĢāĻžāχāϞ, āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰāĻŋ āĻ…āĻĨāĻŦāĻž āϏāĻ•āϞ āĻĢāĻžāχāϞ āĻāĻŦāĻ‚ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰāĻŋ āĻĒā§āϰāĻĻāĻžāύ āĻ•āϰ⧇ āĻĨāĻžāϕ⧇āĨ¤

āϏāĻŋāύāĻŸā§āϝāĻžāĻ•ā§āϏ:


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

āĻĒā§āϰāĻĻāĻžāύ āĻŽāĻžāύ:

āĻ¸ā§āĻŸā§āϰāĻŋāĻ‚

āĻĒā§āϝāĻžāϰāĻžāĻŽāĻŋāϟāĻžāϰ:

āĻĒāĻžāĻ ā§āϝ: āĻ…āύ⧁āϏāĻ¨ā§āϧāĻžāύ āĻĒāĻžāĻĨ, āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰāĻŋ āĻ…āĻĨāĻŦāĻž āĻĢāĻžāχāϞ āωāĻ˛ā§āϞ⧇āĻ–āĻ•āĻžāϰ⧀ āϝ⧇āϕ⧋āύ⧋ āĻ¸ā§āĻŸā§āϰāĻŋāĻ‚ āĻāĻ•ā§āϏāĻĒā§āϰ⧇āĻļāύāĨ¤ āĻļ⧁āϧ⧁āĻŽāĻžāĻ¤ā§āϰ āĻĒā§āϰāĻĨāĻŽāĻŦāĻžāϰ Dir āĻĢāĻžāĻ‚āĻļāύ āĻ•āϞ āĻ•āϰāĻžāϰ āϏāĻŽā§Ÿ āĻāχ āφāϰāϗ⧁āĻŽā§‡āĻ¨ā§āϟāϟāĻŋ āωāĻ˛ā§āϞ⧇āĻ–āĻŋāϤ āĻšāĻŦ⧇āĨ¤ āφāĻĒāύāĻŋ āϚāĻžāχāϞ⧇, URL āύ⧋āĻŸā§‡āĻļāύ āĻ āĻāĻ•āϟāĻŋ āĻĒāĻžāĻĨ āĻĒāĨ¤āϰāĻŦ⧇āĻļ āĻ•āϰāĻžāϤ⧇ āĻĒāĻžāϰ⧇āύāĨ¤

Attrib: āϝ⧇āϕ⧋āύ⧋ āχāύāϟāĻŋāϜāĻžāϰ āĻāĻ•ā§āϏāĻĒā§āϰ⧇āĻļāύ āϝāĻž āĻŦāĻŋāϟ āĻ…āύ⧁āϏāĻžāϰ⧇ āĻŦ⧈āĻļāĻŋāĻˇā§āĻŸā§āϝ āωāĻ˛ā§āϞ⧇āĻ– āĻ•āϰ⧇ āĻĨāĻžāϕ⧇āĨ¤ 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 Invalid procedure call

53 File not found 53 File not found

āωāĻĻāĻžāĻšāϰāĻŖ:


Sub ExampleDir
REM āĻ āϏāĻ•āϞ āĻĢāĻžāχāϞ āĻāĻŦāĻ‚ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰ⧀ āĻĒā§āϰāĻĻāĻ°ā§āĻļāĻŋāϤ āĻšā§Ÿ
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!