Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5319 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hello folks!

After days of trying to solve this, I need some advice: How can I get the name of a file from a full path name? It has to work on Mac and Windows paths and should be coded in Groovy so that I can include it into a script within Scriptmaster.

Path format Mac OSX:

/Users/Dekstop/scs1.png

Path format Windows:

C:Documents and SettingsUserNameMy Documentsscs1.png

Thanks for your support!

Martin

Posted

You create a Java File object

File file = new File( "/Users/Dekstop/scs1.png" );


then:


return file.getName()

http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#getName()

This topic is 5319 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.