Askitemlist files by date Example
; Listing files by date
;This script is an example of how you can sort files by Y:M:D:H:M:S (date)
;
;
;
thelist=fileitemize("C:\dateitem\*.*") ;retrieves unsorted list
askitemlist("Unsorted list of files",thelist,@tab,@unsorted,@single);debugging here
count=itemcount(thelist,@tab);counts items in list
recsize=282;record size
buff=BinaryAlloc(recsize*count)
For x= 1 to count
thefile=itemextract(x,thelist,@tab)
thetimecode=fileymdhms(strcat("C:\dateitem\",thefile))
thefile=strfix(thefile," ",263) ;padding the string
thefile=strcat(thefile,thetimecode)
binarypokeStr(buff, (x-1)*recsize, thefile)
Next
BinarySort(buff,recsize,263,19,@ascending|@String);set type of sort
For x=1 to count
line=BinaryPeekstr(buff,(x-1)*recsize,263)
line=strtrim(line)
if x==1
newlist=line
else
newlist=StrCat(newlist,@Tab,line)
endif
next
askitemlist("Files listed by date",newlist,@tab,@unsorted,@single)
message("all","Done")
Article ID: W13883
Filename: Sort files by date.txt