I’m trying to develop a small solution to get the first file inserted into a particular folder…
So I can process them from the oldest to the newest.
This is what im using:
String.Join(“”, Directory.GetFiles(PastaDownloadDocumentos,“*.pdf”,SearchOption.AllDirectories).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Take(1))
Those are my pdf files:
In this case, I want to process in the first place the file from 12:58, but with my expression, I’m getting the file from 13:08.
Hello Goku, I really don’t know if I want a loop, because the loop will pull all files in the folder almost at the same time and I don’t want that because each file must be processed individually.
I just want the robot to go to the folder and pick the oldest file and that same file will be moved for a final location. So if i have a loop i will have to pull all the files at the same time and moved them all at the same time and process them all at the same time, and something will gone wrong xD
String.Join("", Directory.GetFiles(PastaDownloadDocumentos,"*.pdf",SearchOption.AllDirectories).OrderByDescending(Function(d) New FileInfo(d).LastWriteTime).Take(1))
String.Join(“”, Directory.GetFiles(PastaDownloadDocumentos,“*.pdf”,SearchOption.AllDirectories).OrderByDescending(Function(d) New FileInfo(d).LastWriteTime).Take(1))
With this expression, the robot is processing the last pdf in folder, in terms of arrival.
And I want to process the oldest one.
String.Join(“”, Directory.GetFiles(PastaDownloadDocumentos,“*.pdf”,SearchOption.AllDirectories).OrderByAscending(Function(d) New FileInfo(d).LastWriteTime).Take(1))
That is the challenge as I said earlier with Creation and LastWriteLine when files are downloaded. What if you use Ascending? Do you get the expected, I am assuming it should because that will be the least distant time (last modified closest to Now).