in reply to Directory operations

Since i don't have a clue how your script looks and what your exact problem is (eg. don't you know how to create a directory, don't you know how to keep track of your files/folders you want to copy / create), i assume the first and suggest you start to do some reading, and look at How (Not) To Ask A Question to help you a bit further.
To create a folder use mkdir.
mkdir("/path/to/new/dir");
"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.