How not to read the same file again which is processed already from folder?


#1

Hi everyone i want to read multiple files from one folder and i am using for each file loop to read excel files,what should i do so that everyday whenever it loops the folder files it should not read the already processed file. i am not using any database currently i just want that setting to be done in the work flow.
Thanx
regards


#2

You can get the present day files into the loop.

Today’sFiles = Directory.GetFiles(“path_to_directory”).Where(x => new FileInfo(x).CreationTime.Date == DateTime.Today.Date);`


#3

Hi @vvaidya thanx alot but what if i run the robot again multiple times a day ??
is there something like setting flag similar to database??


#4
  1. you can write the file names to a text file/excel and filter them out during next run.

  2. rename the file to abc.txt to abc_read.txt

  3. get files created after last run by storing last run time in a file (when cycle ended)

@nara var files = directory.GetFiles()
.Where(file=>file.LastWriteTime >= from_date);


#5

Thank You @vvaidya awwsm:+1:


#6

I suggest to try KrojamSoft BatchRename