Extract to file duplicate information
<p>I want to create the file with particular name. If it already exists then I want to create another file with the name appended by some number. 
For example, I want to create the file <code>log.txt</code> but it is already there. Then I will create new file <code>log1.txt</code>, <code>log2.txt</code>, <code>log3.txt</code>....<br><br>
Is there any good way to record into the file duplication information?</p>