Detect the newest file in a specific folder and pass it as an argument to another process. The first argument to your program will be the folder, and the second argument will be the full path to the process.
Please specify the platform(s) your code works on.
newestfile "C:\Public_domain_movies\" "C:\Mplayer\mplayer.exe"
./newestfile /home/user /bin/ls