FTP file delete

Hi Team,

I want hold only 3 month in the FTP. remaning data to be delete it contains multiple sub folder in the ftp… i want check the file creation date is more than 3 month to be deleted from ftp…

Thanks
Shyam

Hi @Shyam_Pragash

Try using the below code:

CurrentFile.CreationTime < DateTime.Now.AddMonths(-3)

Hope it helps!!

Hi @Shyam_Pragash

Check the below thread,It might helps you

Hello @Shyam_Pragash

  1. FTP File Cleanup Sequence:
    a. FTPConnect:
    - Host: ftp.example.com
    - Port: 21
    - Username: your_username
    - Password: your_password

    b. List Files:
    - Use FTP activity or Invoke PowerShell Script to list files and their creation dates.
    - Assign the result to a DataTable variable (e.g., dtFiles).

    c. Filter Files (Older than 3 months):
    - Use FilterDataTable activity.
    - Condition: “CreationDate < '” & DateTime.Now.AddMonths(-3).ToString(“yyyy-MM-dd HH:mm:ss”) & “'”
    - OutputDataTable: dtOldFiles

    d. Iterate through old files and delete them:
    - ForEachRow in dtOldFiles:
    i. Sequence:
    - Use FTP activity or Invoke PowerShell Script to delete the file.
    - Access file details using [CurrentRow].

    e. FTPDisconnect.

Thanks & Cheers!!!