Skip to content

Instantly share code, notes, and snippets.

@thutterer
Created July 15, 2015 19:32
Show Gist options
  • Select an option

  • Save thutterer/4ce4e6b4fea0800df48b to your computer and use it in GitHub Desktop.

Select an option

Save thutterer/4ce4e6b4fea0800df48b to your computer and use it in GitHub Desktop.
Look in all subfolders for all files of certain types and dig them up
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: Provide file extensions as arguments"
exit 1
fi
for ext in "$@"
do
for subdir in *; do [ -d "${subdir}" ] && mv ${subdir}/*.${ext} .; done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment