automv.sh ========= Usage: ./automv.sh Prereqs: Requires bash with the following utilities: grep xargs find mktemp csplit Setup: the script searches the directory: /usr/local/etc/automv.d/ for any .conf files Overriding the automv.d location: If you want to set a different automv.d location setup the: AUTOMV_DIR environment variable How it works: it basically automates the finding of non-hidden files in the source dir and will move them to an existing directory automv.d/ conf syntax ===================== The conf files use the following syntax: # comments query= this is the query you want to use in 'find -regex' source= this is the directory you want to search in target= this is the target directory to move the found files to We explicitly parse out those 3 properties (see extract function in script) !!! Note - do not quote wrap anything - the script expects unwrapped values example conf ============ # jpegmv.conf # moves jpeg files downloaded to pictures query=.*\.jp[e]?g source=/home/user/Downloads/ target=/home/user/Pictures/ example multi query conf ======================== # picturemv.conf # jpeg/jpg query.*\.jp[e]?g$ source/home/user/Downloads/ target=/home/user/Pictures/ --- query=.*\.png$ source=/home/user/Downloads/ target=/home/user/Pictures/ --- query=.*\.webp source=/home/user/Downloads/ target=/dev/null Nice to haves / Tasks to be done ================================ [x] Better logging of moves - we repeat the find like 3 times to be [ ] Timestamps in logs? [ ] More flexibility / configurability [ ] Fault tolerance [ ] Auto mkdir -p if the target dir doesn't exist? [x] Multiple queries per file? What if you have diverging regexes? does find support ORs?