Script to get Ignition data folder path

Is there a script or a way to know where the data folder is installed on the server?

I have to get browse the perspective views folder and I search a way to get where it is.

You need access to the gateway context, which isn’t trivial if you’re not in a custom module. There’s some examples on this forum - it’s technically an “unsupported” technique, since accessing the gateway context also gives you access to irrevocably break your gateway if you do something bad.
From the GatewayContext, you need to get the SystemManager, via the appropriately named getter. From there, there’s a simple getDataDir() function.