You can't rename a directory or file programatically. You have to make a copy with the new name and then delete the original. Obviously, if you are talking about a directory you have to make the function recursive so that it will transfer the entire directory structure inside the original directory.
If you like, I can send you a VI that I wrote to do this.
Mike...