Rmdir not working

I am trying to remove a directory, any sub directories and files within the directory. I have tried using the rmdir command but it isn’t working. I don’t believe it is because of file permissions.

rmdir('../maindirectory/$variablename');

I have read that rmdir only removes empty directories but I tried to remove an empty directory and it didn’t work either. Could someone help me out with some code to accomplish this? Thanks

I belive you can not have variables in between’ ’ they need to be between " " try:

rmdir("../maindirectory/$variablename"); 

Thanks for your help - unfortunately that didn’t seem to work either…