前のトピック: ExistFile - ファイルの有無の調査次のトピック: FindFirst - 検索で最初に見つかったファイルの名前を返す


FindClose - 検索処理の終了

NetWare、Symbian OS、UNIX、Windows、および Windows CE で有効です。

FindClose 関数は検索処理を終了します。

ファイルの内容に関するこの関数の形式は、以下のとおりです。

FindClose(Handle as Integer) as Boolean
handle

終了する検索処理のハンドルを指定します。

この関数が正常に完了すると、TRUE が返されます。それ以外の場合は、FALSE が返されます。

例: FindClose 関数

この例では、引数として渡されるディレクトリの内容が繰り返しリストされます。

Function contents(root as string) As Boolean
	Dim fileName As String
	Dim iHandle As Integer
	Dim rootRoot As String
	
	rootRoot = Mid(root, 0, len(root)-1)
	iHandle = FindFirstFile(root, fileName)) Then
	If iHandle = 0 Then
		Print("No files found at """ + root + """")
	Else
		Repeat
			If Is_Dir(rootRoot + fileName) Then
				Print("""" + rootRoot + fileName + """ is a directory")
				if Not(fileName = ".") AND Not(fileName = "..") Then
					contents(rootRoot + fileName + "¥*")
				End If
			Else
				Print("""" + rootRoot + fileName + """ is a file")
			End If
		Until Not(FindNextFile(iHandle, fileName))

		FindClose(iHandle)
	End If
	contents = TRUE
End Function

Dim i As Integer
ClrScr()
if Argc() = 1 Then
	終了
End If
For i=1 To Argc()-1
	Print(NEWLINE$ + "Recursive List of """ + Argv(i) + """")
	Contents(Argv(i))
Next i

Invokation: dmscript sample.dms c:¥* -w_dms

関連項目:

FindFirstFile - ディレクトリ内のファイル検索