Total members 11893 |It is currently Tue Nov 05, 2024 3:43 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





show all files in a directory with details like name,modification date , size.
Code:
<html>
<%
 
    Dim strFilePath
, strRelativePath, objFileSystem, objFile, objFileInstance, objFolder, objFolderFiles
    strFilePath 
= Request.ServerVariables("SCRIPT_NAME")
    ' get path relative to server .
    strRelativePath = Server.MapPath(strFilePath)
    '
 File System Object .
    objFileSystem = CreateObject("Scripting.FileSystemObject")
    ' get file related to file path .
    objFile = objFileSystem.GetFile(strRelativePath)
    '
 get the folder object instance.
    objFolder = objFile.ParentFolder
    
' get all files in folder.
    objFolderFiles = objFolder.Files
%>
<center><b>Files in directory with details</b></center>
<br/>  
<table> 
<tr> 
<th>File Name</th> 
<th>Size</th> 
<th>Date Last modified</th> 
</tr> 
<%
    '
loop on file instances .
For Each objFileInstance In objFolderFiles 
        Response
.Write("<tr><td><b>")
        Response.Write(objFileInstance.Name)
        Response.Write("</b></td><td>")
        Response.Write(objFileInstance.Size)
        Response.Write("</td><td>")
        Response.Write(objFileInstance.DateLastModified)
        Response.Write("</td></tr>")
Next 
%> 
</table>
</
html>
 


You can also get for example the created date of a file :

Code:
<html>
<
p>
<%
 
    Dim objFileSystem
, objFile
    objFileSystem 
= Server.CreateObject("Scripting.FileSystemObject")
    objFile = objFileSystem.GetFile(Server.MapPath("test.txt"))
    Response.Write("test.txt  is created on:  " & objFile.DateCreated)
    objFile = Nothing
    objFileSystem 
= Nothing
%>
</
p>
</
html>
 




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : show all files in a directory with detail
 Print all files in a directory     -  
 compute number of files in directory     -  
 count the number of files in directory & its sub directories     -  
 SEO Detail     -  
 php Directory lister     -  
 Creating a Directory in php     -  
 Delete directory in php     -  
 phone directory     -  
 Read the content from directory     -  
 Get Directory size in java     -  



Topic Tags

ASP Files and I/O
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com