I have created a script/function that checks all the files in a specified directory for HTML comment tags and if it finds any, it removes the HTML comments and copies everything from the directory into a new directory. Therefore, we end up with 2 directories. 1 with files containing HTML comments and the other with files that have had the comments removed.
The point of all of this is security. We donít want the user to see the HTML comments, however the developerís need them, to assist with structured programming.
This function works just fine, however Iíd now like to increase the scope of the function so that it will remove the comments from all files below the directory. At the moment it just goes through one directory and if it encounters another directory it wonít go through that directory as well.
So my question is:
How can I ensure that I will cover every file of every directory. Is there a special order that it needs to be done in. I.e. do I need to go to the bottom of the directory and work my way up? Do I need to map the path when changing directories? Do I need to use recursion. Basically, Iím not sure how to approach this!!!!