asp偶有好几年没碰过了,下面是VB代码,妳自己改一下就可以了 Dim fd As Folder, fw As File, f Dim objFSO As New Scripting.FileSystemObject Set fd = objFSO.GetFolder("c:\test") Set f = objFSO.OpenTextFile("c:\test\文件列表.txt", ForAppending, True) f.WriteLine "c:\test下的文件列表:" For Each fw In fd.Files f.WriteLine fw.Name Next f.Close Set f = Nothing Set fd = Nothing Set objFSO = Nothing
asp代码 set fso=server.createobject("scripting.filesystemobject") '一定!!要像我这么写 set thefolder=fso.getfolder(server.mappath("liuxiaoyi")) '像楼上那么写很有可能权限不够 set thefile=fso.opentextfile(server.mappath("xx.txt"),8,1) '要写forappending也要先赋值的 for each item in thefolder.files thefile.writeline item.name next set thefile=nothing set thefolder=nothing set fso=nothingasp 有一些权限要求的,跟vb是不大一样的
Dim objFSO As New Scripting.FileSystemObject
Set fd = objFSO.GetFolder("c:\test") Set f = objFSO.OpenTextFile("c:\test\文件列表.txt", ForAppending, True)
f.WriteLine "c:\test下的文件列表:"
For Each fw In fd.Files
f.WriteLine fw.Name
Next f.Close
Set f = Nothing
Set fd = Nothing
Set objFSO = Nothing
set fso=server.createobject("scripting.filesystemobject") '一定!!要像我这么写
set thefolder=fso.getfolder(server.mappath("liuxiaoyi")) '像楼上那么写很有可能权限不够
set thefile=fso.opentextfile(server.mappath("xx.txt"),8,1) '要写forappending也要先赋值的
for each item in thefolder.files
thefile.writeline item.name
next
set thefile=nothing
set thefolder=nothing
set fso=nothingasp 有一些权限要求的,跟vb是不大一样的