473,394 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

File Attributes with ASP in HTML

Not sure if this is the spot to ask but I need some help with a script I
hijacked and put to my own use in an .ASP page

any ways I am using the FilesystemObjects to get a directory and file
listing and generating a web page of that listing, but I need to filter out
files with the SYSTEM tag, so it wont show files I dont want it to, Below is
my full code for the ASP page, I have Commented where I need to change the
listing structure, if anyone can help me filter these out I would be
greatfull!!!
--- Begin code ---
<%@LANGUAGE="VBSCRIPT"%>
<%
Option Explicit
On Error Resume Next

' this section is optional - it just denies anonymous access
If Request.ServerVariables("LOGON_USER")="" Then
Response.Status = "401 Access Denied"
End If

' declare variables
Dim objFSO, objFolder
Dim objCollection, objItem

Dim strPhysicalPath, strTitle, strServerName
Dim strPath, strTemp
Dim strName, strFile, strExt, strAttr
Dim intSizeB, intSizeK, intAttr, dtmDate

' declare constants
Const vbReadOnly = 1
Const vbHidden = 2
Const vbSystem = 4
Const vbVolume = 8
Const vbDirectory = 16
Const vbArchive = 32
Const vbAlias = 64
Const vbCompressed = 128

' don't cache the page
Response.AddHeader "Pragma", "No-Cache"
Response.CacheControl = "Private"

' get the current folder URL path
strTemp = Mid(Request.ServerVariables("URL"),2)
strPath = ""

Do While Instr(strTemp,"/")
strPath = strPath & Left(strTemp,Instr(strTemp,"/"))
strTemp = Mid(strTemp,Instr(strTemp,"/")+1)
Loop

strPath = "/" & strPath

' build the page title
strServerName = UCase(Request.ServerVariables("SERVER_NAME"))
strTitle = "Contents of the " & strPath & " folder"

' create the file system objects
strPhysicalPath = Server.MapPath(strPath)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strPhysicalPath)
%>

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title></title>
</head>

<body text="#C0C0C0" bgcolor="#000000">

<div align="center">
<table border="0" width="80%" id="table1">
<tr>
<td align="center">Some web page Info here<p align="right"><b><font
size="4">And here</font></b></td>
</tr>
</table>
</div>
<p align="center">
<img border="0" src="Folder.jpg">
</p>

<p align="center"><a href="../">Back</a></p>
<html>
<body>

<div align="center"><center>
<table width="100%" border="0" cellspacing="1" cellpadding="2">

<%
''''''''''''''''''''''''''''''''''''''''
' output the folder list
''''''''''''''''''''''''''''''''''''''''

Set objCollection = objFolder.SubFolders

For Each objItem in objCollection
strName = objItem.Name
strAttr = MakeAttr(objItem.Attributes)
dtmDate = CDate(objItem.DateLastModified)
%>
<% Next %>

<%
''''''''''''''''''''''''''''''''''''''''
' output the file list
''''''''''''''''''''''''''''''''''''''''

Set objCollection = objFolder.Files

For Each objItem in objCollection
strName = objItem.Name
strFile = Server.HTMLEncode(Lcase(strName))

intSizeB = objItem.Size
intSizeK = Int((intSizeB/1024) + .5)
If intSizeK = 0 Then intSizeK = 1

strAttr = MakeAttr(objItem.Attributes)
strName = Ucase(objItem.ShortName)
If Instr(strName,".") Then strExt =
Right(strName,Len(strName)-Instr(strName,".")) Else strExt = ""
dtmDate = CDate(objItem.DateLastModified)
%>
' This is where I am listing the Files in my webpage, but it lists all
files, and I need to block the listing of system Files'
<tr>
<td align="left">A<%=strFile%></a></td>
<td align="right"</td>
<td align="right">
<p align="left"><%=intSizeK%>K</td>
</tr>
<% Next %>

</table>
</center></div>

</body>
</html>
Jun 27 '08 #1
1 1929
EQNish wrote:
Not sure if this is the spot to ask but I need some help with a
script I hijacked and put to my own use in an .ASP page
Answered in .scripting.vbscript

This was the most appropriate place to post this, but Alex is doing a
good job with it in .scripting
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: MG | last post by:
I'm in need of a form method similar to the typcial "file upload", but rather than submitting the entire file, I need just the filename. I cannot find anything as part of FORM that would allow...
3
by: Janaka | last post by:
I've seen and used some samples where you can set the onclick attrubute to a Button control to get it to do some javascript a la : btnUse.Attributes = "DoSomeJS()"; However when i try and get...
5
by: JH | last post by:
I am scanning selected drives and computers and capture all files and their attributes. I am using the scripting file system object. It takes a long time to collect the attributes. Is there a...
4
by: Fred Lazy | last post by:
Is is possible to retrieve the name of an .js file from within the .js file itself: For example, if the file is named "bla.js" and it is imported into an html document: <script...
4
by: Marko Vuksanovic | last post by:
I am trying to cause the uplaod button, id="Upload",when clicked, to exectue the onClick event for Button1, id="Button1". <asp:FileUpload id="FileUpload" runat="server"> </asp:FileUpload>...
3
acoder
by: acoder | last post by:
How to Upload a File in Coldfusion Use the cffile tag for uploading files to the server. Note that allowing people to upload files is fraught with danger and only trusted users should be...
1
roswara
by: roswara | last post by:
Dear all, Currently, I am working on a project to make a web-based application using ASP 2.0 and C#. This application will ask user to input for an excel file which has graphs in it. Then the...
4
by: Alvin SIU | last post by:
Hi all, I have 6 tables inside a MS Access 2003 mdb file. I want to convert them as DB2 version -8 tables in AIX 5.2. I have exported them as 6 XML files. The XML files look fine. Each...
15
by: patf | last post by:
Hi - experienced programmer but this is my first Python program. This URL will retrieve an excel spreadsheet containing (that day's) msci stock index returns. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.