Jump to content

Print all the files in a folder


yklxmas

Recommended Posts

Hi,I've followed the example on the website and it doesn't work. Please give me a hand on this. Many thanks in advanceThe error I got:Error Type:Microsoft VBScript compilation (0x800A03FC)Expected 'Next'/cis/folder.asp, line 9The code I copied:<%dim fs,fo,xset fs=Server.CreateObject("Scripting.FileSystemObject")set fo=fs.GetFolder("c:\")for each x in fo.files 'Print the name of all files in the test folder Response.write(x.Name & "<br />")nextset fo=nothingset fs=nothing%>

Link to comment
Share on other sites

In the bolded statement, next and set fo=nothing needs a space<%dim fs,fo,xset fs=Server.CreateObject("Scripting.FileSystemObject")set fo=fs.GetFolder("c:\")for each x in fo.files'Print the name of all files in the test folderResponse.write(x.Name & "<br />")nextset fo=nothingset fs=nothing%> Try this..<%dim fs,fo,xset fs=Server.CreateObject("Scripting.FileSystemObject")set fo=fs.GetFolder("c:\")for each x in fo.files'Print the name of all files in the test folderResponse.write(x.Name & "<br />")nextset fo=nothingset fs=nothing%>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...