I am seeking to automatically delete (with the user's permission), backup Zip files that are older than x days (date()- x), but I don't know how to determine the date of a file so that it can be deleted if it meets the criteria. The best I can come up with is below which looks at the number of backup files that have been created and not the date. Anyone have any ideas? Thanks.
'Code
path = a5.Get_Path() + chr(92) + "ZIP Backups" + chr(92) + "*.zip"
path2= a5.Get_Path() + chr(92) + "ZIP Backups" + chr(92)
files = filefind.get(path)
'ui_msg_box("",*count(files))
IF *count(files)> 50 THEN
'Displays a message box (style:'Yes, No, Cancel Buttons', image: 'Attention symbol', id: 'Zip Houskeeping').
DIM ZipHouskeeping_result as N
DIM ZipHouskeeping_YES_Button as L
DIM ZipHouskeeping_NO_Button as L
DIM ZipHouskeeping_CANCEL_Button as L
ZipHouskeeping_YES_Button = .F.
ZipHouskeeping_NO_Button = .F.
ZipHouskeeping_CANCEL_Button = .F.
title_var = "Housekeeping"
message_text_var = <<%text%
<html>
<head>
<meta name="generator" content="Alpha Five HTML Editor">
<title></title>
<style>
<!--
p { margin-top: 0; margin-bottom: 0 }
-->
</style>
</head>
<body>You have more than 50 backup files. It is recommended that you delete
files older than 60 days. Press "YES" to obtain list of files. Choose files to
delete using regular Windows procedures. </body></html>
%text%
ZipHouskeeping_result=ui_html_msg_box(title_var,message_text_var,UI_YES_NO_CANCEL+ UI_FIRST_BUTTON_DEFAULT+ UI_ATTENTION_SYMBOL,3,1.5,.f.,.t.,"inches","inches","Win3D")
'Test to see which button on the message box was pressed....
SELECT
CASE ZipHouskeeping_result = UI_YES_SELECTED
ZipHouskeeping_YES_Button= .t.
ui_get_file("File List", "*.zip", path2)
CASE ZipHouskeeping_result = UI_NO_SELECTED
ZipHouskeeping_NO_Button= .t.
CASE ZipHouskeeping_result = UI_CANCEL_SELECTED
ZipHouskeeping_CANCEL_Button= .t.
END SELECT
END IF
'Code
path = a5.Get_Path() + chr(92) + "ZIP Backups" + chr(92) + "*.zip"
path2= a5.Get_Path() + chr(92) + "ZIP Backups" + chr(92)
files = filefind.get(path)
'ui_msg_box("",*count(files))
IF *count(files)> 50 THEN
'Displays a message box (style:'Yes, No, Cancel Buttons', image: 'Attention symbol', id: 'Zip Houskeeping').
DIM ZipHouskeeping_result as N
DIM ZipHouskeeping_YES_Button as L
DIM ZipHouskeeping_NO_Button as L
DIM ZipHouskeeping_CANCEL_Button as L
ZipHouskeeping_YES_Button = .F.
ZipHouskeeping_NO_Button = .F.
ZipHouskeeping_CANCEL_Button = .F.
title_var = "Housekeeping"
message_text_var = <<%text%
<html>
<head>
<meta name="generator" content="Alpha Five HTML Editor">
<title></title>
<style>
<!--
p { margin-top: 0; margin-bottom: 0 }
-->
</style>
</head>
<body>You have more than 50 backup files. It is recommended that you delete
files older than 60 days. Press "YES" to obtain list of files. Choose files to
delete using regular Windows procedures. </body></html>
%text%
ZipHouskeeping_result=ui_html_msg_box(title_var,message_text_var,UI_YES_NO_CANCEL+ UI_FIRST_BUTTON_DEFAULT+ UI_ATTENTION_SYMBOL,3,1.5,.f.,.t.,"inches","inches","Win3D")
'Test to see which button on the message box was pressed....
SELECT
CASE ZipHouskeeping_result = UI_YES_SELECTED
ZipHouskeeping_YES_Button= .t.
ui_get_file("File List", "*.zip", path2)
CASE ZipHouskeeping_result = UI_NO_SELECTED
ZipHouskeeping_NO_Button= .t.
CASE ZipHouskeeping_result = UI_CANCEL_SELECTED
ZipHouskeeping_CANCEL_Button= .t.
END SELECT
END IF
Comment