Groovy web console

subscribe to the feed Subscribe
to this
site

Split UNC into path & filename

Published 1 month ago by MMA with tags Path
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def sourceUnc = '\\\\10.129.108.8\\xstore\\IPD-VIA\\Project\\project-via02\\nearlines\\XedioRenderedEdits\\a\\8\\2\\a8268651-513b-3705-ada4-3a7f0dec206d.mpd';

System.out.println(sourceUnc);

def index = sourceUnc.lastIndexOf('\\');

System.out.println(index);

def path = sourceUnc.substring(0, index + 1);
def filename = sourceUnc.substring(index + 1);

System.out.println(path);
System.out.println(filename);

return [path: path, filename: filename]