Copy this code into notepad and save as DeleteOldImages.vbs
'******************* Start of Code *************************
Option Explicit
On Error Resume Next
Dim oFSO, oFolder, sDirectoryPath
Dim oFileCollection, oFile, sDir
Dim iDaysOld
' Specify Directory Path From Where You want to clear the old files
sDirectoryPath = "C:\Users\mike\Desktop\Test"
' Specify Number of Days Old File to Delete
iDaysOld = 15
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(sDirectoryPath)
Set oFileCollection = oFolder.Files
For each oFile in oFileCollection
'This section will filter the text file as i have used for for test
'Specify the Extension of file that you want to delete
'and the number with Number of character in the file extension
If LCase(Right(Cstr(oFile.Name), 3)) = "png"
OR LCase(Right(Cstr(oFile.Name), 3)) = "gif"
OR LCase(Right(Cstr(oFile.Name), 3)) = "jpg" Then
If oFile.DateLastModified < (Date() - iDaysOld) Then
oFile.Delete(True)
End If
End If
Next
Set oFSO = Nothing
Set oFolder = Nothing
Set oFileCollection = Nothing
Set oFile = Nothing
'************************ End of Code ********************
Credit for this script - "Sidd"
http://www.symantec.com/connect/downloads/vbscript-delete-old-files
Delete old images – VB Script
HTTP – HTTPS Redirect
VB codeIf Not Request.IsLocal AndAlso Not Request.IsSecureConnection Then Dim redirectUrl As String = Request.Url.ToString().Replace("http:", "https:") Response.Redirect(redirectUrl) End If
C# codeif (!Request.IsLocal && !Request.IsSecureConnection) { string redirectUrl = Request.Url.ToString().Replace("http:", "https:"); Response.Redirect(redirectUrl); }
Classic asp'do https stuff dim httpsStuff httpsStuff = Request.ServerVariables("PATH_INFO") if Request.ServerVariables("QUERY_STRING") <> "" then httpsStuff = httpsStuff & "?" & Request.ServerVariables("QUERY_STRING") end if if instr(httpsStuff,"/login.asp") OR instr(httpsStuff,"check_user.asp") OR instr(httpsStuff,"/admin_login.asp") OR instr(httpsStuff,"/reset_password.asp") OR instr(httpsStuff,"/new_user.asp") OR instr(httpsStuff,"/personal_info.asp") OR instr(httpsStuff,"/search.asp") OR instr(httpsStuff,"/usr_detail_info.asp") then if lcase(request.ServerVariables("HTTPS")) = "off" then response.redirect("https://www.mywebsite.com" & httpsStuff) end if else if lcase(request.ServerVariables("HTTPS")) = "on" then response.redirect("http://www.mywebsite.com" & httpsStuff) end if end if
Read the content of the folder – VB.NET
<%@ Page Language="VB" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.IO.FileInfo" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<style type="text/css">
ul { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;
font-style: normal; line-height: 25px; font-variant: normal;
color: #0C4F93; text-indent: 5px;
list-style-position: outside; list-style-type: square;
}
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
' make a reference to a directory
Dim DirPath As New IO.DirectoryInfo("C:\\My_Folder")
Dim FCollect As IO.FileInfo() = DirPath.GetFiles()
Dim FInfo As IO.FileInfo
'list the names of all files in the specified directory
For Each FInfo In FCollect
Dim LnItem = New ListItem(FInfo.ToString,
"http://my_webstie/My_Folder" & FInfo.ToString)
BulletedList1.Items.Add(LnItem)
BulletedList1.Target = "_blank"
Next
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>List directory
<link href="Styles/Site.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="page">
<div class="header">
<div class="nav_pos" >
<div class="nav_format">
<% Response.Write(MonthName(DateTime.Now.Month) & " " & DateTime.Now.Day &_
", " & DateTime.Now.Year) %>
<div id='MenuPos' style="position:relative;">
<% Response.WriteFile("site_menu/top_menu.asp")%>
</div>
</div>
<fieldset>
<legend>5500 Forms and Summary Annual Reports for 2011
<form id="form1" runat="server">
<div style="padding-left: 20px;">
<asp:bulletedlist ID="BulletedList1" runat="server"
DisplayMode="HyperLink" BulletStyle="NotSet" >
</asp:bulletedlist>
</div>
</form>
</fieldset>
<div class="footer">Copyright © < %= Date.Today.Year.ToString() %>
- My Website Name® - All Rights Reserved.
</div>
</body>
</html>