Aurigo Posted May 20, 2010 Posted May 20, 2010 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
Valentin Posted May 20, 2010 Posted May 20, 2010 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()
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now