How can you check if there is a new file in a folder?

How can you check if there is a new file in a folder? I’ve checked the solution here, but it has to have a specific file name.

I’m trying to watch a folder so that when there is a new file the file is picked up and an action is done with this file. Otherwise it keeps checking.

Also, if there are two files, the older file is picked up

What commands I need to use to achieve this?

hi @selrac

You can do 2 things here:

  1. After processing files move that file to another folder i.e. processed kind of.
  2. After processing append kind of timestamp or some string with filename like processed or not?.
  3. You can maintain the status with filename in an excel and check first their this name file has been processed or not.
  4. In forum i have posted a solution to check file creation dates and other properties so on the basis of that also you can identify.

for further assistence revisit some already posted posts here on the forum :slight_smile:



Thanks Aksh1yadav,
The problem I have is with the first step. How do I check if the is a file in the folder?

Small input - this one I wouldn’t recommend, especially for larger processes - it scales very poorly and becomes a pain if multiple robots are involved.

Points 1/2 are very good (you can add an intermediate Processing folder in between for clarity), since it’s very easy for humans to see what’s going on without shuffling through logs for processing info.


1 Like

You can get all files within a folder by using:


and Loop through it having an argument String and in loop add your file processing code and also move that file into different folder.



I don’t seem to have Directory.GetFiles. If I search for activities I only see ‘Create Directory’

If you know the filename, try PathExists and select file in the option.

I don’t know the filename. This is the problem. The files are copied to this folder with different filenames

Can you try the below?


It’s a static method call. Put it on the right hand side of an assign and on the left side put a variable of type List(Of String).


WatchFolder2.xaml (9.6 KB)

I seem to be having some errors. I’m attaching xaml

1 Like

Check now

WatchFolder2.xaml (9.4 KB)


Thanks. That works!!



Can I ask you, what did you do to make it work?

1 Like

I made some changes to variable data types.


I see. This is what I couldn’t figure out. Thanks

1 Like

Main.xaml (7.1 KB)
In my case, The folder contains multiple files.
How can I give the file name?
I am using for each activity.
Please check my flow.
@vvaidya @aksh1yadav @ClaytonM

Hi @vvaidya
Is there any possibilities to create if activity and give some condition codes, and give output of pop up message box with new file created found else all are old.
Thank you