mv files recursivelly

i want to move files and directory to a folder called deleted on my home directory. I want to mimic rm -r command.. i made this code and it only moves all the files from the directory but don't mv the directory. please help i tried everything that can to my mind.

 #!bin/bash
function removeDir () {
if ! [ "$(ls -A "$1" )" ]
then
      mv -f $1 ~/deleted
else
           cd $1
           local files=$(ls -A)
           echo $files
           for f in $files
           do
            
                 f2=$(readlink -f $f)
              if [ -d $f2 ]; then
                  removeDir $f2
               else
                   mv -f $f2 ~/deleted
              fi
           done
fi
}
removeDir $@

What's the recursion for? You can just move entire folders...

function movestuff
{
        mv "$@" ~/deleted/
}

well is part of the project. I have to move the folder recursively just like rm -r

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.