I know I can use something like mv *zip zip/
but I want to auto-create each folder if not exists and move my all files to them. With the below code I have to hard code everything. Is there any way to automate this. Like First Get all Extensions of files then Create folders if not exists and move files into them according to file types like png to images/png and mp3 to Audio/mp3 or pdf to Documents/pdf.
find . -name "*.mp4" -exec mv "{}" ./Videos ;
Edit-1
I have figured someway but I don't want to move .sh files how to delete from an array of a specific element and Group filetypes like png, jpg to images/png, images/jpg and mp3 to Audio/mp3 or pdf to Documents/pdf.
array=($(find . -type f | sed 's/.*.//' | sort | uniq ))
for dir in "${array[@]}"; do
[[ ! -d "$dir" ]] && mkdir "$dir"
find . -name "*.$dir" -exec mv "{}" ./"$dir" ;
done