This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Deleting and Renaming files from the system  RSS feed

 
Javed Akhtar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everybody,
I'm making new files in my system through my java application
but I'm not able to delete or rename those files from my application
Thanking you,
Javed
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Send us a sample of your code. Make sure it contains the section with the file I/O.
 
Grant Crofton
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably need to use java.io.File, which has methods for deleting and renaming files.
File holds a file name/path, or a directory. Although it does not actually hold the contents of a file, you can use it to do stuff with the file it points to, like set it's last modified attribute etc.

(you often have to check for exceptions, normally SecurityExceptions, when working with File)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!