I have a nice program to change the background but I want it to operate on subdirectories as well.
# Script to randomly set Background from files in a directory
while true;do
# Directory Containing Pictures
DIR="/home/pc/Pictures"
# Internal Field Separator set to newline, so file names with
# spaces do not break our script.
IFS='
'
# Command to Select a random jpg file from directory
PIC=$(ls $DIR/*.jpg | shuf -n1)
# Command to set Background Image
gsettings set org.mate.background picture-filename $PIC
# specify how long to wait in seconds between changes
sleep 600
done
Hm. To prevent find from running too often - disk intensive to list an entire big directory tree -- how about:
DIR="/home/pc/Pictures"
while true
do
find "$DIR" -type f -name '*.jpg' | shuf | while read PIC
do
gsettings set org.mate.background picture-filename "$PIC"
sleep 600
done
done
Instead of taking the first from the randomized list then throwing the rest away, it will use the entire random-order list.