Delete files on FTP

I need help with this FTP automation, I can download the files, but I can’t delete the FTP files.

@Richarlei_Reis

Can you please show exception from Locals panel and exception details

Cheers

Hi @Richarlei_Reis

Please refer below thread on same. Looks like you will need to get files first and then loop through those to delete them.

Regards
Sonali

Did you check if you have delete permissions in FTP?
Also some FTP servers are set-up to delete file automatically once it is downloaded. It is worth to check also.

Cheers

Yes, I have permission for deletion.

I couldn’t understand this issue, it wasn’t clear, and also the version of FTP is different.

@Richarlei_Reis

Its alright. Looks like now its possible to delete the file under FTP scope by providing its path.

Per the error screenshot you shared, seems the issue with your string path.

Could you please cross verify if thats correct? And how are you providing the full path?

Let’s say you want to delete a file named “my\_file.txt” located on the FTP server at the path “/incoming/data/”. So your path would like below.

  • File Path/Folder Path: “/incoming/data/my\_file.txt”

Path

I am able to delete one file, I need to delete all the files in this folder.

@Richarlei_Reis

in that case, I think you will need to get the list of files in that folder path and then run loop to have all those deleted one by one.

or try to stop at the folder level itself and delete the folder instead of files in it.

@Richarlei_Reis

as per this activity’s configuration, its one file or folder.

I understand, how do I get the list of files inside this FTP folder? Enumerate Objects or Get Directory?

@Richarlei_Reis

enumerate objects should help.

I am still having an error when trying to delete.

@Richarlei_Reis

for file path, it should still be as you had provided earlier for deleting one file, just that now you will append the file name variable there instead of direct file name.

it has to be a full file path not just file name.. like below, just change the last part in there to have file name variable(current.ToString) instead:

example: “/folder path/pendente\”+current.ToString

I managed with current.Name

Thank you @sonaliaggarwal47

1 Like