prompt user to enter a directory name Check if directory name exists If it does prompt user again and ask if the contents of the dir can be overwritten. If it can continue with rest of program otherwise loop round again asking the same questions and doing the same checks again . This bit may need to be run several times depending on whether the user enters an existing dir or not.