• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

file

 
Jackie Wang
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does the code you have written so far look like? What aspect of it is giving you problems?
bear
 
Jackie Wang
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
William Barnes
Ranch Hand
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does the code you have written so far look like?

Please post you code, using *code* tags, and we will be happy to try and help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic