How to delete files on FTP server using Home Assistant?

I save my camera streams locally but also save backups to a cloud storage drive that I can access via FTPS (I know SFTP would be better but this is not possible).

Would like to have Home Assistant connect to the FTP drive, check the disk usage, and delete the oldest files automatically each day.

What is the best way of achieving this?

I know how to run a shell script from an automaition in Home Assistant (if that is the best way) and I am aware of the FTP add-on, but don’t know how to mount an external FTP drive in Home Assistant.

Please note:

  • I am not attempting to access my Home Assistant server via FTP. I want to access an external FTP server from Home Assistant
  • I cannot install scripts or any sort of cron jobs on the cloud server itself
  • I am running Home Assistant OS and don’t want to install something fishy that will cause issues or be deleted every time I update Home Assistant or Home Assistant OS.

Hello DIY-techie,

Here’s some help from the Docs.

Otherwise the ssh addon will let you do ftp, ssh, sftp, rsync, and other similar from the command line it that works better for you.

If you can set the remote to be a samba server, you can use ths samba addon to connect. Many roads to get to the destination here.

Clear up storage - Home Assistant.

Common tasks - Operating System - Home Assistant.