Skip to content

Instantly share code, notes, and snippets.

@robert-spurrier
Created January 15, 2016 13:35
Show Gist options
  • Select an option

  • Save robert-spurrier/0860aea215b39f8ac20b to your computer and use it in GitHub Desktop.

Select an option

Save robert-spurrier/0860aea215b39f8ac20b to your computer and use it in GitHub Desktop.
Copy a given number of random directories to another directory
# Script I use to copy random albums to my mp3 player
# OS X, requires GNU coreutils
ls "$1" | gsort -R | tail -n $3 | while read file; do
cd "$1"; cp -R "$file" $2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment