code: def move_file_to_directory(file_path, directory_path):
          
          file_name = os.path.basename(file_path)  # get name of file
          if not os.path.exists(directory_path):
              os.makedirs(directory_path)  # create directory if necessary
          os.rename(file_path, os.path.join(directory_path,
                                            file_name))
docs: Moves file to given directory
  
          :param file_path: path to file to move
          :param directory_path: path to target directory where to move file