Issue 13601 - The Dir() command does not return files when directories are also requested
Summary: The Dir() command does not return files when directories are also requested
Status: CLOSED NOT_AN_OOO_ISSUE
Alias: None
Product: App Dev
Classification: Unclassified
Component: scripting (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC Windows XP
: P3 Trivial
Target Milestone: ---
Assignee: ab
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-18 20:55 UTC by andrew
Modified: 2013-02-24 21:01 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description andrew 2003-04-18 20:55:04 UTC
According to the documentation, the Dir command should include dirs and files 
if requested. If you include directories, then files are NOT returned!


As taken from the help file:


Sub ExampleDir
	REM Displays all files and directories
	Dim sFile as String, sPath As String
	Dim sDir as String, sValue as String
	Dim iFIle as Integer
	sFile= "Files: "
	sDir="Directories:"
	iFile = 0
	sPath = CurDir
	Rem  0 : Normal files.
	Rem  2 : Hidden files.
	Rem  4 : System files.
	Rem  8 : Returns the name of the volume
	Rem 16 : Returns the name of the directory only.
	sValue = Dir$(sPath, 0 + 2 + 4 + 16) REM 16 + 2 + 4
	'sValue = Dir$(sPath, 22) REM 16 + 2 + 4
	Do
		If sValue <> "." and sValue <> ".." Then
			If (GetAttr( sPath + getPathSeparator() + sValue) AND 
16) > 0 Then
				REM here the directories
				sDir = sDir & chr(13) & sValue
			Else
				REM here the files
				If iFile Mod 3 = 0 Then sFile = sFile + Chr(13)
				iFile = iFile + 1
				sFile = sFile + sValue &"; "
			End If
		End If
		sValue = Dir$
	Loop Until sValue = ""
	MsgBox sDir,0,sPath
	MsgBox "" & iFile & " " & sFile,0,sPath
End sub
Comment 1 andrew 2003-04-18 20:55:51 UTC
Changed to a scripting issue as it should be
Comment 2 andrew 2003-04-20 07:10:48 UTC
Perhaps this is NOT a bug because the online help specifically says:

16 : Returns the name of the directory only.

Which could be interpreted to mean that if the directory is requested
that nothing else is returned and the fact that the included example
does not seem to expect this is of no consequence!

Andrew Pitonyak
Comment 3 andrew 2003-04-21 14:19:51 UTC
I am marking this as invalid after further thought.

An attribute of zero means return files and if obtaining the 
directories did not prevent files from being returned there would be 
no method of finding only directories.
Comment 4 ab 2003-10-16 15:36:08 UTC
Closed