Skip to content

Instantly share code, notes, and snippets.

@dm9876
dm9876 / copy-flatten-unique.sh
Created April 24, 2017 10:54
bash script: copies files from all directories and subdirectories of the source, to single directory of the destination
#copy-flatten-unique.sh
#copies files from all directories and subdirectories of the source, to single directory of the destination
#ie flattens the directory structure
#ensures only files with unique content in the destination, will rename the file if names clash
#original application was to collect and review all attachements from an old gnu mailman (www.gnu.org/software/mailman) mailing list.
Source=.
Dest=~/Documents/dest
if [ ! -d "$Dest" ]; then #create the destination directory if it does not exist