'How to keep buffer and cache down (Linux Fedora 35)?

I've written a bash script that takes media from my mobile phone via webdav mount and DSLR sd card via usb connection and puts it in my ~/Pictures and ~/Video directories.

I'm using rsync to move the files (--remove-source-files) to my home directory and then I use find to find the specific files I need to process and then I'm running exiftool on each to put them where I want them (dated directories, sub-directories from tags, etc). I copy them to one directory and then move them to a similarly structured backup drive which is samba mounted.

$ free -h

               total        used        free      shared  buff/cache   available
Mem:            31Gi       6.6Gi       324Mi       253Mi        24Gi        24Gi
Swap:           15Gi       1.9Gi        14Gi

This process starts off fast but slows down quickly and dramatically.

What is the proper way to accomplish this task that won't use up so much buff/cache or clears it out more often within the process?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source