I'm trying to create a bash function script that will allow me to create multiple directories with the names below. I'm also trying to organize files by extension into their corresponding folders (i.e. .jpg into pictures, .doc into documents, .gif into media, etc). The first part is fine it's the second half after the directories are made that confuses me.
#!/bin/bash
echo "Creating directory categories"
function make_folder
{
cd -; cd content; sudo mkdir ./$1
}
make_folder "documents"
make_folder "other"
make_folder "pictures"
make_folder "media"
echo "Directories have been made"; cd -
exit
ext="${filename##*.}" #set var ext to extension of files
find ./random -name | #find and list all files in random folder
#pipe results of find into if statement
if ext == ["jpg"; "jpeg"; "png"] #move ".jpg", etc to new destination
then
mv /path/to/source /path/to/destination
elif ext == [".gif"; ".mov"] #move ".gif", etc to new destination
then
mv /path/to/source /path/to/destination
else #move other files into to new destination
mv /path/to/source /path/to/destination
fi