Skip to content

Instantly share code, notes, and snippets.

@emanuelvintila
Created June 16, 2020 05:56
Show Gist options
  • Save emanuelvintila/00f3a0dae440cec87c64209471fbb5f7 to your computer and use it in GitHub Desktop.
Save emanuelvintila/00f3a0dae440cec87c64209471fbb5f7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [[ $# -lt 2 ]]; then
echo "The script requires at least 2 arguments."
exit 1
fi
copy_dir="$1"
shift
while [[ $# -ne 0 ]]; do
dir="$1"
shift
if [[ -d "$dir" ]]; then
find "$dir" -type f -perm -u+rwx -exec cp "{}" "$copy_dir" \;
fi
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment