Delete files from FTP Server

Team,

Using - FTP activities to connect to a server
Requirement - If any files present in specified path i need to delete them, but im unable to do so.
PFA, In which i want to delete each file present in str_filecount.
Thanks in advance.

@prerna.gupta

Try item.FullName instead of item.ToString.

By the way, your variable name is quite confusing. str_filecount would lead me to believe it is a string consisting of a number, like “3”.

Hi @prerna.gupta

  1. Create a “For Each” loop to iterate through the list of files obtained from the “Get Files” activity. Set the TypeArgument to “UiPath.FTP.FtpFileInfo”.
  2. Within the loop, add an “Invoke Method” activity to delete each file. Set the following properties:
  • TargetObject: Set it to the FTP session object obtained from the “Connect FTP” activity.
  • MethodName: Set it to “DeleteFile”.
  • Parameters: Add an input parameter of type String and set its value to item.FullName. This represents the full path of the file to be deleted.

Thanks!!

Thanks this works

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.