dcsimg
How can i rename a file to ddmmyyyy.txt
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, May 29, 2003 11:36 AM

Just wondering if anyone has any sample codes on how to rename a particular file(that is of any file extension) that is input by a user to ddmmyyyy.txt or ddmmyyyy.zip?

Re: How can i rename a file to ddmmyyyy.txt

Posted By:   Stephen_Ostermiller  
Posted On:   Sunday, June 1, 2003 06:20 PM

Renaming a file has been covered. The only missing peice for you would be how to come up with the date formated the way you want. Take a look at the SimpleDateFormat class.


String MyFormattedDate = new SimpleDateFormat("ddMMyyyy").format(new Date());

Re: How can i rename a file to ddmmyyyy.txt

Posted By:   Anonymous  
Posted On:   Friday, May 30, 2003 03:20 AM

boolean isRenamed = (new java.io.File("oldname")).renameTo(new java.io.File("newname"));
About | Sitemap | Contact