Skip to content

Instantly share code, notes, and snippets.

@Fusion
Created December 18, 2016 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fusion/4870aba6217fd6fc209318bbf7f7e315 to your computer and use it in GitHub Desktop.
Save Fusion/4870aba6217fd6fc209318bbf7f7e315 to your computer and use it in GitHub Desktop.
Recurse a shell command across 2 directories
function recurse() {
if [ "$#" -lt 3 ]; then
echo "Syntax: recurse dir1 dir2 commandline...";
else
dir1="$1"
shift
dir2="$1"
shift
find $dir1 -type f -exec $@ {} $dir2/{} \;
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment