NetWare、Symbian OS、UNIX、Windows、および Windows CE で有効です。
FindFirstFile 関数では、指定のディレクトリ内のファイルが検索されます。
ファイルの内容に関するこの関数の形式は、以下のとおりです。
FindFirstFile(namespec as String, filename as String) as Integer
ディレクトリ パス、またはワイルドカード ファイル指定を含むファイル パスを識別します。 リテラル文字列を使用しないでください。 以下に例を示します。
Dim filename as string
Dim findHandle as integer
findHandle=FindFirstFile("c:¥windows¥*.dll",filename).
Dim filename as string Dim filehandle as integer Dim path as string Path="c:¥windows¥*.dll" Filehandle=FindFirstFile(path,filename)
見つかったファイルの名前を含む出力パラメータ。
正常に終了した場合、この関数では、FindNextFile および FindClose の入力として使用する検索ハンドルが返されます。それ以外の場合、0 が返されます。 関数が失敗した場合、0 が返されます。
例: FindFirstFile 関数
この例では、引数として渡されるディレクトリの内容が繰り返しリストされます。
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
|
Copyright © 2013 CA.
All rights reserved.
|
|