sort_file = 'c:\andy\zz_sortin.txt'
output_file = 'c:\andy\zz_sortout.txt'
'erase' sort_file output_file
CALL list_files 1,'C:\'
rc = LINEOUT(sort_file)
'sort /+1 /r ' sort_file '/o' output_file
'wordpad' output_file
EXIT 0
list_files: PROCEDURE EXPOSE sort_file
iteration = ARG(1)
search_dir = ARG(2)
more_to_process = 'YES'
DO WHILE more_to_process = 'YES'
result = MATCHNAME(iteration, 'feedback', search_dir, 'DSNHCRAT', 'NS')
IF result \= ""
THEN more_to_process = 'NO'
ELSE DO
IF feedback.0 \= "" THEN DO
out_line = FORMAT(feedback.0, 15) search_dir || feedback
rc = LINEOUT(sort_file, out_line)
END
ELSE DO
new_search_path = search_dir || feedback || '\'
result = list_files((iteration + 1), new_search_path)
END
END
END
RETURN result
|