Use c# action. Initialize variable dirPath before using this action
JavaScript:
var directory = new System.IO.DirectoryInfo(project.Variables["dirPath"].Value);
var myFile = (from f in directory.GetFiles()
orderby f.LastWriteTime descending
select f).First();
return myFile;