%26lt;%
Set fs=Server.CreateObject(';Scripting.FileSy鈥?br>
If (fs.FileExists(';\\panter\test1.jpg';))=tr鈥?Then
Response.Write(';File 1.jpg exist';)
Else
Response.Write(';Call IS department';)
End If
set fs=nothing
%%26gt;
But how could I list all files in that particular \\panther\*.*.How can I use the FileSystemObject or the Drive object in ASP to list all files in a directory I specify?
You can use the Files collection:
Dim MyFolder
MyFolder = ';\\panther\\';
Dim objFSO, objFile, objFileItem, objFolder, objFolderContents
Set objFSO = CreateObject( ';Scripting.FileSystemObject'; )
Set objFile = objFSP.GetFile(MyPath)
Set objfolder = objFile.ParentFolder
Set objFolderContents = objFolder.Files
And then you can iterated through your collection:
For Each objFileItem in objFolderContents
Response.Write objFileItem.Name %26amp; ';%26lt;br%26gt;';
Response.Write objFileItem.Size %26amp; ';%26lt;br%26gt;';
Next
No comments:
Post a Comment