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
Read files from directory and organize them by extentsion into corresponding folders
shell script;find;pipe
From the top of my head I would use the 'case' statement in the end.i.e.case $FILE in    *.jpg|*.jpeg)        mv $FILE to where you want it        ;;    *.gif|*.mov)        mv $FILE to where you want it        ;;    *)        echo Unmanaged file type: $FILE, skipping        ;; esac...however you need to wrap it in a loop container, and you seen determined to use find, and then it would perhaps be appropriate with; find <your stuff> |      while read FILE     do         ...case statement goes here     doneJust my $0.02Cheers!/ Daniel