Little VB program that can delete a folder using the current date

Greetings,

I try to write a rudimentary program that will delete a file.  I'll post some pseudocode to demonstrate what I intend to achieve:

If FileFolder is < 8=""> as CurrentDate

then delete

I looked at a few other Web sites and ran across something that seems possible to use.  I will credit the site: http://www.vbforums.com/showthread.php?684680-RESOLVED-Delete-files-in-folder-that-are-older-than-a-certain-date

Private Sub Command1_Click()
Const FromFolder = "D:\seenu\from\" ' change the path
Const FilePattern = "* .log" "change the model
Dim file As String

File = Dir$ (FromFolder & FilePattern, vbNormal)
Len (File) > 0 do
If Date - FileDateTime (FromFolder & file) > 60 then
'Delete file '.
End If
File = Dir$)
Loop
End Sub

However, I'm not above trying to achieve, I don't know how tell the program to look at the date of the day of the machine and then determine anything more than 8 days before the current date should be deleted.

Once this program is completed and updated, I intend to have Task Scheduler running on a daily basis.

Sincere greetings,

TI banker

Hello

You can try asking the question in MSDN to support forums:

https://social.msdn.Microsoft.com/forums/vstudio/en-us/home?Forum=vbgeneral

I hope this helps.

Tags: Windows

Similar Questions

Maybe you are looking for