Ask a Question

If a network path contains $ sign, how to access that path using groovy?

SOLVED
indraniria
Occasional Contributor

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\\")

1 REPLY 1
KarelHusa
Regular Contributor

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

 

 

Karel@apimate.eu
https://apimate.eu
cancel
Showing results for 
Search instead for 
Did you mean: