HELP: How do i retrieve a whole folder of files using asp please?

J

John

Hi all,
Can anyone help?
What I need to do within ASP is open a pre-selected folder within my
site, then with each file within that folder perform a set of actions.
A simple loop kind of structure would suffice for now.
The filenames won't be known in advance.

The idea is to use it as a basis for a photo gallery.

Any help would be appreciated.
TIA.
 
J

Jim Buyens

Try something along the line of

fsoSysObj = server.createobject("Scripting.FileSystemObject")
Set fdrFolder = fsoSysObj.GetFolder(Server.MapPath("images"))
For Each filFile In fdrFolder.Files
' your code goes here -- During each iteration, filFile points to a
different file.
Next

Also see
http://msdn.microsoft.com/library/en-us/script56/html/FSOoriFileSystemObject.asp

Jim Buyens
Microsoft MVP
http://www.interlacken.com
Author of:
*-----------------------------­-----------------------
|\----------------------------­-----------------------
|| Microsoft Windows SharePoint Services Inside Out
|| Microsoft Office FrontPage 2003 Inside Out
||----------------------------­-----------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/----------------------------­-----------------------
*-----------------------------­-----------------------

http://msdn.microsoft.com/library/en-us/script56/html/FSOoriFileSystemObject.asp
 
J

John

Thanks Jim,
Although I have managed to solve the initial problem, the link you
provided will certainly be handy.
John.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top