Sorting downloads folder with bash script
- by Marek
I'm writing script for my own needs to sort Downloads folder on my mac in bash.
I pass to the function parameters: source directory, destination directory and array of file extensions I want to move. My problem is that when function is in "find" line then it copies just one file with that extension but when I remove all variables and I put parameters directly then it works fine. What's going on ?
function moveFaster(){
clear
src=$1
dst=$2
typ=$3
if [ ! -d $dst ]
then
mkdir $dst
fi
for i in "${typ[@]}"
do
find $src -name "${i}" -exec mv {} ${dst} \;
done
}