I am currently working on a project where i transferred files from sources to destinations that is in excel file. Everytime I move file from source to destination it checks the destination, if file exist and modified date is less than Today.AddDays(-7) in destination folder it creates folder with a filename dated todays date and paste files from source within date range Today.AddDays(-7) to that folder. However when I tried transferring files from source to destination and destination does not have any files it still creates folder. Your help with be much appreciated.
Sorry but where is your condition that tells the Robot to create the folder only if Today.AddDays(-7) is true?
In the Else, you are simply creating the folder as the first step.
LMK if I understood this right.
the DSTSearch.count Variable have this Directory.GetFiles(dst).Where(function (dst) File.GetLastWriteTime(dst).Date >=Today.AddDays(-7)).ToArray. This will only read files in destination folder that meets Today.AddDays(-7). It supposed to create folder if it finds a file within range and let those file outside the subfolder. I was able to do that, but it still creating folder even though there is no files in destination. I have attached here my sample flow. Main.xaml (23.4 KB)
In the above condition you have stated, I am assuming that the “if file exist” part refers to the item object in the For Loop? And each item is a source file?
If this is correct, then where is the item object involved in the condition below?
Directory.GetFiles(dst).Where(function (dst) File.GetLastWriteTime(dst).Date >=Today.AddDays(-7)).ToArray
This condition above just says files modified in the past X days. But where is it saying if item (meaning source file) exists inside of dst?
Just a thought.