Checking if -rj parameter value is a directory or a file and calling the appropriate function for each of them.