Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

file  RSS feed

 
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
Posts: 66208
151
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: 1049
2
IntelliJ IDE Java Spring
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!