select the files from folder .If created files is before 6month,it must be deleted

Posted by Nithya2010 under VB.NET category on | Views : 2646
Imports Scripting

Dim myObject As New FileSystemObject
Dim afolder As Folder
Dim SHDate, MHDate As DateTime
Dim monthsApart As Integer
Dim f As File

afolder = myObject.GetFolder("E:\\Fileeg")

For Each objFile In afolder.Files

SHDate = Convert.ToDateTime(DateTime.Now.ToShortDateString())
MHDate = Convert.ToDateTime(objFile.DateLastModified)
monthsApart = 12 * (SHDate.Year - MHDate.Year) + SHDate.Month - MHDate.Month
Response.Write(objFile.Name & " : ")
Response.Write(objFile.DateLastModified & "<br>")
If monthsApart>6 Then
End If

Comments or Responses

Posted by: Peermohamedmydeen on: 8/26/2010 Level:Bronze | Status: [Member] | Points: 10
Hi Nithya,

This code may work fine with the user having administrator rights or may be a power user.

In my scenario, Am neither a administrator nor a power user and am running the application. Will this file object.delete() will happen?

In such cases what will be the actions need to taken care?

Please explain with user rights.

PMM :)

Login to post response