First off, you need to go into your Mozilla settings and change the default download folder options. For automation, you want to “know” where you are downloading stuff. By doing this, you can also choose the filename, therefore, you don’t need to do anything special and just use the filename which you used to download the file to.
However, just to share a method to accomplishing what you originally ask, you can grab the last file with some .net.
Directory.GetFiles(downloadDir, filename+"*.pdf").OrderByDescending(Function(f) new FileInfo(f).CreationTime )(0)
so it pulls in all files that have a certain pattern (I used .pdf as extension and filename is a variable to represent what the file will be called). Then, orders by the creation time… and hopefully I did that right
Like I said though, I don’t recommend dealing with this, and just set your default download location in Mozilla (and Chrome if you use that browser)
EDIT: you want to set it to “ask where to download”