Skip to content

Instantly share code, notes, and snippets.

@kevinSuttle
Last active August 29, 2015 14:25
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 kevinSuttle/f7ffd6f3b0750e2ed5be to your computer and use it in GitHub Desktop.
Save kevinSuttle/f7ffd6f3b0750e2ed5be to your computer and use it in GitHub Desktop.
Bash 3.2: copy specific file names and files with specific extensions
#!/usr/bin/env bash
declare -a backup_files=(*.{id,nsf}, desktop8.ndk archive user.dic);
declare -a notes_data_directory=~/Library/Application\ Support/IBM\ Notes\ Data/;
declare -a notes_backup_directory=~/Desktop/Notes\ Backup;
mkdir -p "$notes_backup_directory";
cd "$notes_data_directory";
for i in "${backup_files[@]}"
do
cp -nipvR "$notes_data_directory$i" "$notes_backup_directory";
# find "$notes_data_directory""$i" -exec cp -nipvR {} "$notes_backup_directory" \;
done
# OUTPUT: All files are copied from the backup_files array except for .id files and .nsf files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment