Only read files that have been modified after file created

I have a file directory that gets new draft file every day. Each draft file is modified to a final version on the same day but it’s not saved as a different file name.

I have a for loop that checks the file directory & adds each file name to an array.

Ideally, i’d like a conditional statement that only picks up on the files that have been modified after 30 mins of the file initially being created & appends the final version of the data to a weekly overview excel.

Can this be done?

1 Like

There are no activities for this, unless you want to use File Change Trigger activity inside Monitor Events but this is not really feasible since the robot will have to run for long periods of time to be able to capture a file change. However, you can make use of FileInfo class to obtain CreationTime and LastWriteTime properties and compare them. Here’s an example: Main.xaml (13.7 KB)

Please note that LastWriteTime can be an earlier date than CreationTime if the file was copied, because when you copy a file it has a new CreationTime while LastWriteTime remains unchanged. So make sure the file isn’t copied around after it is modified.


That’s great, thank you!
I hadn’t actually considered that about the lastWriteTime being earlier if the file was copied. Good to know!

Thanks again!