Have you tried adding a leading slash ("/") to the directory names? Something like this?
Otherwise, this could be a function that's only related to files (though this functionally is based upon a Unix environment). Have you also tried detecting the directory after trying to move it, e.g.
if not dir.dir_exists("user://dir_name"):
push_error("Directory doesn't exist")
If all else fails, try copying the directory:
You could then remove the old directory, though that's a bit harder, as the
remove() function will only delete empty directories.