Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Files in Directory

Status
Not open for further replies.

pleddy

IS-IT--Management
Jul 2, 2001
5
US
Im trying to create a script that will take a directory off of a webserver and display the filenames of all of the image files that are located in that directory. Can anyone offer any suggestions.

-pleddy
 
Hi,
If I were trying to accomplish this I would use ASP. What you are trying to do is more of a server action instead of a client side one. If you would like help doing this via ASP let me know.
 
My webserver is a coldfusion server. Therefore I can't use asp. But if you could accomplish this in Coldfusion I would like your input.
 
Well I don't know Cold Fusion so the best I can do is show you a script that I use to search a folder and delete certain files

<% @ language= vbscript%>
<% dim strPathInfo, strPhysicalPath 'The following script checks the report file for PDF files and deletes old ones
strPhysicalPath = &quot;directory/foldername&quot;
Dim objFSO,objFile, objFileItem, objFolder, objFolderContents
set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)

Set objFile = objFSO.GetFolder(strPhysicalPath)
Set objFolder = objFile.Files
for each objFileItem in objFolder ' finding all PDF files that are more than 1 day old and deleting them
if instr(1,objFileItem.Name,&quot;.pdf&quot;)> 0 and (dateDiff(&quot;D&quot;,objFileItem.DateCreated,Date))>1 then

objFileItem.delete


end if

Next

%>

I hope that this helps some at least.

Good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top