_ivanovich_
4 years agoFrequent Contributor
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.
I tried this:
log.info filex
it returns true
i tried
log.info filesx.toString()
it returns true
The goal is to set custom property with the path and the the name of the newly renamed file.
like: C:\\temp\\test-03-12-2021_08_48_20.txt
Thank you for having a look
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.