473,395 Members | 2,713 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,395 software developers and data experts.

Tweak to existing code

Hello group.
I have some code (given to me), but I don't know alot about ASP, so I was
hoping someone here can help.

The code below will scan a folder and subfolder with a date/time input and
return xml structure off all files that are newer than the supplied date/time.

The problem is that the returned xml has path names like
C:\folder\subfolder\filename.ext
I would like it to be more like /folder/subfolder/filename.ext
Also, the initial path gets returned in the xml "data", but I only want the
sub folders below "data" to get scanned and info returned...
Any help would be greatly appreciated.

function indent(iTreeLevel)
dim rv : rv = ""
if iTreeLevel 0 then
for i = 1 to iTreeLevel
rv = rv & " "
next
end if
indent = rv
end function

'==========================================

function newItemsCount(objFolder, dCutoffDate)
dim rv : rv = 0
dim sFileModified
For Each objFile In objFolder.Files
sFileModified = objFile.DateLastModified
If (sFileModified dCutoffDate) Then
rv = rv + 1
End If
Next
newItemsCount = rv
end function

'==========================================

function newItemsSize(objFolder, dCutoffDate)
dim rv : rv = 0
dim sFileModified
For Each objFile In objFolder.Files
sFileModified = objFile.DateLastModified
If (sFileModified dCutoffDate) Then
rv = rv + objFile.Size
End If
Next
newItemsSize = rv
end function

'==========================================

sub FolderListing(strPath, dCutoffDate, blnRecursive, iTreeLevel)

Dim objFolder
Set objFolder = objFSO.GetFolder(strPath)

response.write(indent(iTreeLevel) & "<folder name=""" & objFolder.Name &
""" newitems=""" & newItemsCount(objFolder, dCutoffDate) & """
newitems_size=""" & newItemsSize(objFolder, dCutoffDate) & """>" & vbCrLf)

For Each objFile In objFolder.Files
sFileSize = objFile.Size
sFileName = objFile.Name
sFileType = objFile.Type
sFileCreated = objFile.DateCreated
sFileModified = objFile.DateLastModified
If (sFileModified dCutoffDate) Then
response.write(indent(iTreeLevel) & " <file name=""" & sFileName & """
size=""" & sFileSize & """ date=""" & sFileModified & """ url=""" & strPath &
"\" & sFileName & """/>" & vbCrLf)
End If
Next

If blnRecursive Then
Dim objSubFolders
Set objSubFolders = objFolder.SubFolders
For Each objFolder in objSubFolders
sFolderName = objFolder.Name
sFolderPath = strPath & "\" & sFolderName
FolderListing sFolderPath, dCutoffDate, blnRecursive, iTreeLevel+1
Next
End if

response.write(indent(iTreeLevel) & "</folder>" & vbCrLf)

end sub

'================================================= ========================================
sDateTime = unescape(Request.QueryString)
aDateTime = split(sDateTime, " ")
sDate = aDateTime(0)
sTime = aDateTime(1) & " " & aDateTime(2)
dDate = DateValue(sDate)
dTime = TimeValue(sTime)
dDateTime = dDate + dTime

Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
%>

<?xml version="1.0" encoding="utf-8"?>

<newfiles fromdate="<%= dDate %>" datestr="<%= sDate %>" timestr="<%= sTime
%>" resultdatetime="<%= dDateTime %>">

<%
FolderListing server.MapPath("data"), dDateTime, true, 0
%>

</newfiles>
--
Thanks!
Bryan
Aug 19 '08 #1
2 1174
"Bryan" <Br***@discussions.microsoft.comwrote in message
news:87**********************************@microsof t.com...
I have some code (given to me), but I don't know alot about ASP, so I was
hoping someone here can help.

Unfortunately, you're in the wrong newsgroup - this one is for ASP.NET

For ASP, please post to: microsoft.public.inetserver.asp.general
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 19 '08 #2
Thanks,
I will repost in the correct group.

--
Thanks!
Bryan
"Mark Rae [MVP]" wrote:
"Bryan" <Br***@discussions.microsoft.comwrote in message
news:87**********************************@microsof t.com...
I have some code (given to me), but I don't know alot about ASP, so I was
hoping someone here can help.


Unfortunately, you're in the wrong newsgroup - this one is for ASP.NET

For ASP, please post to: microsoft.public.inetserver.asp.general
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 19 '08 #3

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

Similar topics

0
by: Luke Airig | last post by:
I am trying to merge two xml files based on common date/time and then write out a tab-delimited xml file with the header record from one of the input files concatenated in front of the merged...
2
by: 'perch | last post by:
I'm trying to tweak the Google toolbar search button to do two things; to include selected text as a string search (i.e. as though I'd entered the text in ""), and to open a new page for the search...
3
by: Jane D | last post by:
I have got a bookmarklet for use with Opera which highlights all occurrences of some text in the displayed page. I find it very useful. Sometimes I need to use two or three different colours...
0
by: Josué Maldonado | last post by:
Hello list I use postgresql ODBC driver (Version 7.03.02) to access the database (7.3.4) running on RH8, the connection string is:...
5
by: Nadav | last post by:
Hi, Introduction: ************************************************************ I am working on a project that should encrypt PE files ( Portable executable ), this require me to inject some...
1
by: Christopher W. Douglas | last post by:
I am building a VB.NET application in Visual Studio.NET 2003. I have an existing project with code and forms I want to reuse in this project. If I am copying a module file, then Add Existing Item...
4
by: DGS | last post by:
Hi all... Yesterday I asked about setting a cookie with an intially requested URL that could be used later. I found the code to do it. For the code on the login.html page I would like to tweak...
8
by: =?Utf-8?B?QnJ5YW4=?= | last post by:
Hello group. I have some code (given to me), but I don't know alot about ASP, so I was hoping someone here can help. Running on Win 2008 server. The code below will scan a folder and subfolder...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.