OK here we go.
I will try to paint the picture for you as best as I can.
An example would be a folder c:\data and within that folder are other sub folders.
Within each root folder and sub folders are files. Each files has been created and uploaded to the root folder and sub folders at different dates.
The goal I was hoping to get to was to run the kix to scan first the root and look for any files that are past 15 days old to delete, and then also scan all subfolder and delete any files in the sub folder that are past 15 days old.
The date would be based off of the modified date.
Using the UDF function SerialDate($ExpD) I was able to write this script.
Code:
cls
break on
$path = 'c:\data
$file = dir($Path + '\*')
GLOBAL $X
;used for days compare check
$days=15
$line =1
while $file <> "" and @error = 0
$ft = getfiletime($path + '\' + $file)
$fs = getfilesize($path + '\' + $file)
$size = $foo +','+ $bar
$store = substr($file,12,3)
if $ft ;it's a file not a dir !
; List the files
$file_date = substr($ft,1,10)
;used for looking for older files
$result=SerialDate(@date)
$result=$result-$days
$result=SerialDate($result)
if $file_date < $result
;? '$file $file_date'
$size = GetFileKB($path + "\" + $file)
$line=$line+1
;DELETE FILES
$foo = $path + "\" + $file
; REMARKED THE DEL OUT FOR TESTING
; del $foo
? $foo +" "+$file_date
endif
endif
$file = dir()
loop
$line=$line-1
But I cannot do the subfolders and looking at the dirplus UDF only got even more confused.
Do I even need dirplus? Can I just do this to sub folders also?