LibreOffice 24.8 सहयोग
रनटाइम, वा सबै फाइलहरूको र त्यो निर्दिष्ट खोजी मार्गमा जोडा मिल्ने ड्राइभमा वा डाइरेक्टरी भएका डाइरेक्टरी फाइलको नाम फर्काउँछ ।
Dir [(PathName As String [, Attributes As Integer])]
स्ट्रिङ
PathName: Any string expression that specifies the search path, directory or file. This argument can only be specified the first time that you call the Dir function. If you want, you can enter the path in URL notation.
Attributes:Any integer expression that specifies bitwise file attributes. The Dir function only returns files or directories that match the specified attributes. You can combine several attributes by adding the attribute values:
० : सामान्य फाइलहरू
१६ : डाइरेक्टरीको नाम मात्र फिर्ता गर्दछ ।
यदि फाइल वा डाइरेक्टरी अवस्थित भएको खण्डमा क्लिक गर्नलाई वा निर्दिष्ट डाइरेक्टरीमा सबै फाइल र फोल्डरहरू निर्धारण गर्नलाई यो विशेषता प्रयोग गर्नुहोस् ।
जाँच गर्नलाई यदि फाइल अवस्थित भएको खण्डमा पुर्ण मार्ग र फाइलको नाम प्रविष्ट गर्नुहोस् । यदि फाइल वा डाइरेक्टरीको नाम अवस्थित नभएको खण्डमा डाइरेक्टरी प्रकार्यले शून्य लम्बाइ स्ट्रिङ ("") फर्काउँछ ।
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).
Sub ExampleDir
' ले सबै डाइरेक्टरी र फाइलहरू प्रदर्शन गर्दछ ।
Dim sPath As String
Dim sDir As String, sValue As String
sDir="डाइरेक्टरीहरू:"
sPath = CurDir
sValue = Dir$(sPath + getPathSeparator + "*",16)
Do
If sValue <> "." And sValue <> ".." Then
If (GetAttr( sPath + getPathSeparator + sValue) And 16) >0 Then
' ले डाइरेक्ट्रहरू पाएको छ
sDir = sDir & chr(13) & sValue
End If
End If
sValue = Dir$
Loop Until sValue = ""
MsgBox sDir,0,sPath
End Sub