Forum Discussion
Looking at your regex, it looks like it would match a date pattern and i use regex101 allthe time so i dont think the problem is there.
This is a guess by me, but i suspect the issue is probably related to your filename variable. I might be able to help fix it, but my coding is nowhere near as good as the groovy experts on here. Either way i'd suggest publishing all your groovy so people can see how youve defined your filename variable along with the logs of exactly what is happening when you execute your current code.
Ta
Rich
- AAB3 years agoRegular Contributor
Hello richie
Thanks for your response. The original groovy is in the previous ticket. Not to overload all tickets with the same code, I thought it would be allright just to put the link of the previous ticket in here?
Cheers,
AAB
- richie3 years agoCommunity Hero
Hey AAB
my bad - I didn't notice the link. This replaceAll code works fine on normal parameters stored in the project cos I've used it loads and the regex is correct.
HOWEVER - you're working with filenames arent you?
I take it the log.info filenameWithoutExtension in your code works, right?
the groovy experts (like nmrao, @aaronpliu etc.) would know better than I - but I'm wondering if you actually explicitly pass the value into a property BEFORE you use the regex to remove the date whether that would work?
ta
Rich
- AAB3 years agoRegular Contributor
Hi richie Thanks for your help man! but meanwhile I had a lot of reading, struggling, irritation to look for what I wanted and I had to change some things in my code. A lot of differences between java.io and java.nio, not be able to work with File and Path together, irritating error messages like I didn't know where to look for. So I came back to Groovy for a part and I found the best way for me to work with:
Copy all the files in source folder to a target folder
iterating through the files in target folder and adding dateTime to it.
And that works already! 😎 🤑
Now I need to find a way to empty the target folder at the end of the testcase.
I'll post my result in here once done. Maybe someone else could use this in the future!
for now, Cheers!
Kind regards,
AAB
Related Content
- 6 months agomacheshmeh
- 9 months agoenschim
- 11 months agoakilan
Recent Discussions
- 7 hours agogroovyguy