indraniria
3 years agoContributor
If a network path contains $ sign, how to access that path using groovy?
As of now , I am mapping that network drive to a local drive in my system, list below:
File f = new File("A:\\Private\\Test\\")
But in actual network drive path I have a $ sign like, \\opscif\\$operation. If I write like below, I get error.
File f = new File("\\opscif\\$operation\\Test\\")
The dollar is a special sign in Groovy and has its function in double-quoted "strings".
You have two options:
- use single quotes, such as 'hello$'
- use double quotes with a backslash before the dollar sign, i.e., "hello\$"
Best regards,
Karel