Detect the newest file and pass it to a process Challenge

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.

Examples

Windows

newestfile "C:\Public_domain_movies\" "C:\Mplayer\mplayer.exe"


Linux

./newestfile /home/user /bin/ls
Zsh - 15

Only tested on Linux, but it should work on other platforms too.

$2 $1/*(.om[1])