Delete existing file in download activity

I have a wait for download activity, within which I have a download file activity. The issue I am having is that if the file exists already then the process gets stuck on these activities - is there a way of deleting the file that already exists - bearing in mind I won’t know the name of the file

Hello @E.T.S, try this:

  1. Check if File Exists:
  • Before the “Wait for Download” and “Download File” activities, add a “File Exists” activity to check if a file with a specific file extension (e.g., .tmp or .crdownload) exists in the download folder. These temporary file extensions are often used by browsers while downloading files.
  1. Conditional Logic:
  • In your workflow, use conditional logic (e.g., an “If” activity) to check the result of the “File Exists” activity.
  • If the file exists (result is True), add a sequence to delete or move the existing file to another location. You can use the “Delete File” activity or other file manipulation activities for this purpose.
  1. Wait for Download and Download File Activities:
  • After handling the existing file (if it exists), continue with your “Wait for Download” and “Download File” activities as you normally would.

Cheers! :slight_smile:

Hi @E.T.S
You can use File Exists to check whether the file exists and store it in a variable say DownloadFileExists.
Use an If condition and give the below condition

        Delete File activity
        //Continue with process
       //Continue with downloading the file steps

Hope it helps!!

hi @E.T.S

If you are using wait for download activity, in there what activity you are using, mostly it would be some kind of Ui interactive activity, which would trigger the download…

Can you share the properties of your download file activity?


The issue is I won’t know the name of the file so I can’t use a file exists activity which is why I am using the wait for download activity so I can file a temporary name like this:

I won’t know the name of the file which is the issue - is there an alternative to file exists perhaps?

Create a new, empty folder for the file to download into. Then existing files don’t matter.

If the file already exists, doesn’t it rename the newly downloaded file with a (1) on the name?

Normally it does but because I won’t know the filename I have put it into a wait for download activity so I have an identifier for the file

The Wait for Download activity looks at how many files are in the folder, waits for a new file to be created, and returns that file. It doesn’t need to know the name of the file.

use currentitem


Do you mean if current item exists? Please could you explain thanks

exactly if current item exists you do whatever you need to do :slight_smile:

@E.T.S ,

The File Checking if it is already existing could be done in the below way :


Hey @E.T.S

Since you are using this Download file activity.
Don’t use the wait for download activity.
Just before using the download file activity

use a FileExists

and check the boolean variable if it says true

use a delete file Activity

to delete the strDownloadLocation.

Hoping that your downloadLocation variable would be having full file path with extension of file.


This works perfectly in an if statement thank you! The small issue I’m having is that I am trying to delete the file if it exists - I have added a delete file activity and when I run the process it is successful but that file still exists in the folder

@E.T.S ,

Could you show us the Implementation done ?

@E.T.S ,

You would require to use the Full File Path again in Delete File Activity :