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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Little fso problem ??????

Status
Not open for further replies.

iceb

Technical User
Jan 13, 2002
64
DK
Hi

I have this asp code that lists files in a directory

and I want to limit the list to ONLY files created

within 10 seconds from now .....

how do I do this ?

Here is my code ....

Hej Eksperter .... s

Har lavet en fso kode der lister

alle mine filer i min dir og nu vil jeg

gerne have en if sætning på så kun filer

som er oprettet indenfor de sidste 10 sekunder

vil blive udskrevet ok ?

Her er min kode .....






<%
'***************** File
Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set folder = fso.GetFolder(Server.Mappath(&quot;/flash/&quot;))
Set files = folder.Files

For Each file in Files
Response.Write file.Name & &quot;<BR>&quot;
Response.Write file.DateCreated & &quot;<br>&quot;
Next

Set files = folder.Files
Set file = Nothing
Set fso = Nothing

%>
 
Try:

For Each file in Files
if datediff(&quot;s&quot;, file.datecreated, now) < 10 then
Response.Write file.Name
end if
next
 
This will list each folder (but not files) contained within the folder you designate in the &quot;current&quot; variable...

===================

<% @ Language=VBScript %>
<% Response.Expires = 0 %>
<%
Dim fso, folder, folders, current

'# Current Folder to list contents ###
current = &quot;C:\&quot;
set fso = Server.CreateObject(&quot;scripting.FileSystemObject&quot;)
set folders = fso.GetFolder(current)


'# Write the name of each folder that is part ###
'# of the subfolder group of the object &quot;folders&quot; ###
For each folder in folders.subfolders
Response.Write(&quot;  &quot; & folder.name & &quot;<BR>&quot;)
Next


'# Clean up ###
Set folders = Nothing
Set fso = Nothing

%>



Hope this helps! -Ovatvvon :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top