What I want this automation to accomplish?
I want to move some excel files that get downloaded from a web directly into a user’s downloads. There are two conditions that need to be met before a file should be moved. The first condition is the file names must starts with “Bid+Form” which is working fine. The second condition, which has the error, is to move a file where creation date is today (or if possible 5 minutes after the complete execution of the workflow).
What I have done so far?
The workflow I have so far can move files from downloads directory into a specific folder location (the error comes when I try to add where condition in the assign activity after the file path). I read a couple forum postings, but without success finding a solution. I also looked up some vb.net examples, but I was not able to transfer that knowledge into my workflow.
Thank you so much for your time and your help!
Since it’s vb.net you will need to have Function() to start the .Where.
.Where(Function(f) Directory.GetCreationTime( f ).ToShortDateString = Now.ToShortDateString )
So f can be any word you want to use that represents each item in the array, then you can just use the Directory.GetCreationTime and compare it with Today. You can also add other conditions if you’d like, for example if you want to only use .pdf extensions or if filename contains a word. To add other conditions include AND then the second condition; Path.GetExtension can be used.
Thanks for your help with this issue!
I am getting a new error that says as shown in the screen shot. fileArray datatype is an array of strings.
Can you check the variable declaration like
Have to assign the variable like this.
Add .ToArray on the end inside the Assign
I think that’s the issue.
Thank you ClaytonM ! it works now after I added .ToArray.
Thanks for your suggestion. I just added .ToArray and it worked.