by KA Bucci (2 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 3rd March 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Delete Files by File Date
'PurgeResp = DTPicker.value
'Need to set values for DestDrive and DestPath
Dim MyFile, MyStamp, DestDrive, DestPath
MyFile = Dir(DestDrive + DestPath + "\*.txt")'Change Extension
Do
MyStamp = FileDateTime(DestDrive + DestPath + "\" + MyFile)
MyStamp = DateValue(Left$(MyStamp, 10))
If MyStamp < PurgeResp Then Kill(DestDrive + DestPath + "\" + MyFile)
MyFile = Dir
If MyFile = "" Then Exit Do
Loop
MsgBox "Selected files purged.", vbOKOnly, "Purge Files"