I would like to write and create a file in a directory, says /root/mytest/ the file name will be mytest.txt. If mytest.txt is there. I would like to create the new files as mytest_1.txt, if it's also there, new files will be mytest_2.txt. What should I do? Thanks!
I am create some file after running some exe file. I hope the first file name will be mytest.txt while if there is 1 more file generate, won't overwrite the old one. thx