Automation to do a file copy?

I use Frigate and have it notify my phone when various things happen such as Person spotted.

I would like to create an automation action to copy the jpg to another folder?

How do I do this with YAML please?

Only thing I know would be to use the command line sensor
Command Line - Home Assistant (home-assistant.io)

I do this in my frigate automation

alias: Driveway Camera Create Latest Snapshot
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.driveway_person_occupancy
    to: "on"
condition: []
action:
  - service: camera.snapshot
    data:
      filename: /config/www/snapshots/driveway_latest.jpg
    target:
      entity_id:
        - camera.driveway_person
mode: single

Thank you @pcwii ! i’ve been lurking on this forum for multiple years, and you gave me reason to create an account! This solved half the problem I was working on.

Do you know of a way to do this for the most recent camera clip vs just the jpg?

The Frigate Mobile Notifications Blueprint is great, but I see no way to save to a folder vs send to a phone.

First off welcome to the community. I do not use the frigate Mobile Notifications Blueprint. I do however use an e-mail script to send me the snapshot that I grab when an image is detected.
I have an automation that calls the script. I can’t remember why I did it this way as it has been a while.
The automation is as follows…

alias: Motion_E-Mail
description: Send Camera Pictures via E-Mail
trigger:
  - entity_id:
      - sensor.porch_person_count
    from: "0"
    platform: state
  - entity_id:
      - sensor.driveway_person_count
    from: "0"
    platform: state
    enabled: false
condition:
  - condition: state
    entity_id: person.me
    state: not_home
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - data: {}
    entity_id: script.1595080596760
    service: script.turn_on
  - delay: "00:05:00"
mode: single

The script is this…

alias: E-Mail Picture
sequence:
  - service: camera.snapshot
    data:
      filename: /config/www/snapshots/porch_best.jpg
    target:
      entity_id: camera.porch_person
  - service: camera.snapshot
    data:
      filename: /config/www/snapshots/driveway_best.jpg
    target:
      entity_id: camera.driveway_person
  - service: notify.email_notifier
    data:
      message: Kelsey.AI Detected Someone at the Front Door!
      title: Person Detected Alert! {{ now().strftime("%Y%m%d-%H%M%S") }}
      data:
        images:
          - /config/www/snapshots/porch_best.jpg
          - /config/www/snapshots/driveway_best.jpg
mode: single
icon: mdi:mail

All of this is using the smtp integration.

I have this in my configuration yaml.

#Sample gmail notifier
notify:
  - platform: smtp
    name: email_notifier
    server: smtp.gmail.com
    port: 587
    timeout: 15
    sender: !secret notify_account
    encryption: starttls
    username: !secret notify_account
    password: !secret notify_pass
    recipient:
      - [email protected]
    sender_name: My Home Assistant

I hope this is helpful.

Thank you! I try with this.