long ll_filecount
long ll_cnt
long ll_filehandle
date ldt_today_date
date ldt_temp_file
string ls_file
string ls_full_path
string ls_directorya
string ls_filename
string ls_filename1
datetime ldt_today
datetime ldt_filedatetime
//get file time
long lul_date
long lul_time
int lui_year
int lui_month
int lui_day
int lui_hour
int lui_minute
int lui_second
s_WIN32_FIND_DATA ss_file
if fc_isnull(trim(as_file_path), "") = "" then
return 0
end if
ls_directorya = trim(as_file_path)
if right(ls_directorya, 1) = '\' then
ls_file = ls_directorya + '*.*'
else
ls_file = ls_directorya + '\*.*'
end if
if not lb_files.DirList(ls_file, 0+1+2+16+32) then
return -1
end If
ll_filecount = lb_files.TotalItems()
for ll_cnt = 1 To ll_filecount
ls_file = lb_files.Text(ll_cnt)
if left(ls_file,1) = '[' then
ls_filename = right(ls_file,len(ls_file) - 1)
ls_filename = left(ls_filename,len(ls_filename) - 1)
if ls_filename = '..' then continue
else
if right(ls_directorya, 1) = '\' then
ls_filename1 = ls_directorya + ls_file
else
ls_filename1 = ls_directorya + '\' + ls_file
end if
ll_filehandle = FindFirstFileA(ls_filename1,ss_file)
FindClose(ll_filehandle)
//get file time begin
if ll_filehandle =-1 then
setnull(ldt_filedatetime)
else
filetimetodosdatetime(ss_file.ftlastwritetime,lul_date,lul_time)
lui_day = mod(lul_date,32)
lui_month = mod(lul_date,512)/32
if lui_month = 0 then
lui_month = 1
end if
lui_year = lul_date/512+1980
lui_second = mod(lul_time,32)*2
lui_minute = mod(lul_time,2048)/32
lui_hour = (lul_time)/2048 + 8
if lui_hour >= 24 then
lui_hour = lui_hour - 24
ldt_filedatetime = datetime(relativedate(date(lui_year,lui_month,lui_day),1),time(lui_hour,lui_minute,lui_second))
else
ldt_filedatetime = datetime(date(lui_year,lui_month,lui_day),time(lui_hour,lui_minute,lui_second))
end if
end if
//get file time end
if daysafter(date(ldt_filedatetime),date(adt_file_del_dt)) > 0 then
if filedelete(ls_filename1) <> true then
return -1
end if
end if
end if
next