# replaced $counter with $i. for ($i=1; $i<10; $i++){ ........... } #### Result: folder1, folder1.[1], folder1.[2], folder1.[3]...etc.