I would like new images to be uploaded to Immich from my phone and deleted after 30 days automatically, so I was thinking about this flow:

  1. I will Sync files to the server using Syncthing

  2. I will Copy files from the Synced folder to an Immich Consume folder, (not sure how to copy only new files (maybe use created date)). Then delete images that are older than 30 days which will remove them from my phone.

  3. I will upload to Immich using Immich CLI (?) which will use the delete after upload flag.

Basically:  

(1)

Camera, Screenshots, etc =Syncthing=> SyncthingImageConsume/{Folder}

(2)

{Script on SyncthingImageConsume}

SyncthingImageConsume/{Folder} =CopyNewFiles=> ImmichConsume/{Folder}

Then delete older than 30 days.

(3)

{Script on ImmichConsume}

Upload to immich and then delete

 

would this work? and is there a better way to do it? any tips?

  • Mir@programming.devOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    5 months ago

    (except I manually sort through my photos on a semi-weekly basis before I upload it to Immich).

    I think that would be a better approach if I weren’t very lazy, I think even after the initial run I could do that since I don’t take lots of pictures but I was thinking about a fire and forget sort of thing.

    If you want, I can cook up a little Python script you could stick into Cron to do all the tasks you described.

    Thank you so much, I asked ChatGPT and it generated the bat file below (since I’m using Windows) do you think this would work?

    @echo off
    REM Change directory to your photos folder
    cd /d "C:\path\to\your\photos\folder"
    
    REM Sync files to backup folder
    robocopy . "C:\path\to\your\Camera_Backup" /mir /xo
    
    REM Delete files older than 15 days
    forfiles /p "C:\path\to\your\photos\folder" /s /m *.* /d -15 /c "cmd /c if @isdir==FALSE del @file"
    
    REM Upload assets using immich cli
    immich upload "C:\path\to\your\Camera_Backup" -r -a --delete