wood burning stoves*
The moose likes Ant, Maven and Other Build Tools and the fly likes how to name a file to a specific filename (xxxx_xxx_YYYYMMDD_HHMM) with ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "how to name a file to a specific filename (xxxx_xxx_YYYYMMDD_HHMM) with ant" Watch "how to name a file to a specific filename (xxxx_xxx_YYYYMMDD_HHMM) with ant" New topic
Author

how to name a file to a specific filename (xxxx_xxx_YYYYMMDD_HHMM) with ant

Sam Zou
Ranch Hand

Joined: Nov 18, 2002
Posts: 40
Hi,

I'm trying to create a tar file with ant but I want ant to
name it to a very specific filename :
xxxx_xxx_YYYYMMDD_HHMM

where Y = year, M = month, D = day, H = hour , M = minute

Basically it is the time and date where that file was created.


Is there a way to create such a filename with ant ?


Thanks


Sam<p>"Life is difficult"<br /> -Scott Peck-</p>
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

There is a seperate Ant forum where this question would be better posted.

You can use the tstamp task to create the time stamp and assign the value to a property. Something like this:


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Originally posted by Paul Sturrock:
There is a seperate Ant forum where this question would be better posted.

You can use the tstamp task to create the time stamp and assign the value to a property. Something like this:


Indeed. I will move this thread there.


[Jess in Action][AskingGoodQuestions]
 
jQuery in Action, 2nd edition
 
subject: how to name a file to a specific filename (xxxx_xxx_YYYYMMDD_HHMM) with ant
 
Similar Threads
problem retrieving a zip file from FTP server using org.apache.commons.net.ftp.
Problem with InputStream using org.apache.commons.net
ANT - Build failed
ant - search contents of jar
manifest file question