Forum Discussion

_ivanovich_'s avatar
_ivanovich_
Frequent Contributor
4 years ago

How to get filename with path after renaming it with groovy?

Hi, with groovy i can rename a file with: def filex = new File("C:\\temp\\test.txt").renameTo(new File("C:\\temp\\test"+(sdf.format(date))+".txt")) now i want to know the file name newly renamed. ...
  • ZDGN's avatar
    ZDGN
    4 years ago

    Hi _ivanovich_ 

     

    In case you still want to know, the command you were looking for is:

     

    log.info filex.getName()

     

    I use to concatenate path, current date, file name and extension to get the full path.
    So I can retreive any fo those information ğŸ˜‰

     

    Have a nice day.

     

    David.