So I have a python script in the NAS that calculates the MD5 checksum of every photo and video, and generates a shell script that, when executed on the phone, will calculate the MD5 on the local device, and delete if it is equal to the NAS.
The generated shell script gets sent to the phone, then I execute it from within a Termux window, pointing at the DCIM folder.
I can free up tens of GB of memories with reliability in the face of a misbehaving sync algorithm.
[1] https://help.nextcloud.com/t/auto-upload-is-skipping-random-...
And having tools like exiftool, ffmpeg, and ImageMagick among others available in Termux is wonderful.
If you install Termux widgets, you can directly start the script from your Android launcher's Home screen.
I have deep trust issues with commands that work on more than one file at a time.
What I like about my process is that there is only one source script (the python one) to keep around.