spiderman0009
Technical User
Hi I am very new to understanding this stuff in the second paragraph.
This is the most complex example that I have worked with. In the example below why did they create variables for f1, s when they are not used below in the code? Another question why do they use and declare a variable for the drivelet, why don't the just use "c:" in part filesys.GetDrive(drivelet) like this filesys.GetDrive(C.
Last question why don't they define the variable fileobj before they use it in this code? "For Each fileobj in rootfiles" They use this... code. This code following says output all the fileobj variables that it finds. Correct? Could I use any other name for fileobj. and it would work?Correct? <%=fileobj.Name%> I am a little shakky on this stuff. I am still trying to understand the basic of VBScript
<%
Dim fileSys, drv, f1, s, rootdir, rootfiles, fileobj
Dim drivelet
drivelet = "c:"
Set filesys = CreateObject("Scripting.FileSystemObject"
' Get the Price object based on the drive letter
Set drv = filesys.GetDrive(drivelet)
' Get the Drive's root folder
Set rootdir = drv.RootFolder
'Get the files in the root folder
Set the rootfiles = rootdir.Files
'Loop through all the files and display them
For Each fileobj in rootfiles
%>
<%=fileobj.Name%> <p>
<%
Next
%>
Thank You Troy
This is the most complex example that I have worked with. In the example below why did they create variables for f1, s when they are not used below in the code? Another question why do they use and declare a variable for the drivelet, why don't the just use "c:" in part filesys.GetDrive(drivelet) like this filesys.GetDrive(C.
Last question why don't they define the variable fileobj before they use it in this code? "For Each fileobj in rootfiles" They use this... code. This code following says output all the fileobj variables that it finds. Correct? Could I use any other name for fileobj. and it would work?Correct? <%=fileobj.Name%> I am a little shakky on this stuff. I am still trying to understand the basic of VBScript
<%
Dim fileSys, drv, f1, s, rootdir, rootfiles, fileobj
Dim drivelet
drivelet = "c:"
Set filesys = CreateObject("Scripting.FileSystemObject"
' Get the Price object based on the drive letter
Set drv = filesys.GetDrive(drivelet)
' Get the Drive's root folder
Set rootdir = drv.RootFolder
'Get the files in the root folder
Set the rootfiles = rootdir.Files
'Loop through all the files and display them
For Each fileobj in rootfiles
%>
<%=fileobj.Name%> <p>
<%
Next
%>
Thank You Troy