in reply to sorting a directories content

you'll need to stat each file to get the information you need (date/time stamps etc) and devise a sort routine.
the hardest line to type correctly is: stty erase ^H