Skip to content

Instantly share code, notes, and snippets.

@ghostrydr
Created April 8, 2020 21:41
Show Gist options
  • Save ghostrydr/fb7b017f5901a13a64a824862c5332dc to your computer and use it in GitHub Desktop.
Save ghostrydr/fb7b017f5901a13a64a824862c5332dc to your computer and use it in GitHub Desktop.
Aggregate and symlink images from subdirectories
#!/bin/bash
# usage
# ---------
# ./aggregate-desktop-bgs /path/to/source /path/to/target
# then set deskto background to pull from /path/to/target in system settings
# default values
SOURCE=${1-~/Pictures/desktops}
TARGET=${2-~/Pictures/aggregated-bgs}
HIDDEN=${3-.hidden}
# clear directory
find $TARGET -type l -delete
# link desired files
find $SOURCE -name $HIDDEN -prune -o -regex '.*\.jpe*g' -exec ln -s {} $TARGET \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment