Hi,
I'd like to extract a specific folder name within {folder} that will always be one of 3 names, how would I go about doing it?
For example, if {folder} gives me:
`~/Downloads/example1/Movies/<name of movie>`
and the part I want is always one of `example1`, `example2`, `example3`, how can I extract that?
I would want the final filename to contain `[example1]`.
Thanks,
James.
extracting part of {folder}
Re: extracting part of {folder}
OK, got it.
`f.path.match()`
I was trying `f.match()` not realising that `path` had to be used.
`f.path.match()`
I was trying `f.match()` not realising that `path` had to be used.
Re: extracting part of {folder}




Re: extracting part of {folder}
thanks!
I couldn't find any reference to the `.path` element - where can I learn more about this and any others like it?
I couldn't find any reference to the `.path` element - where can I learn more about this and any others like it?
Re: extracting part of {folder}


Re: extracting part of {folder}
awesome - thanks!
I like rabbit holes!
could you expand a little on `f[-2]` - I can't seem to get that to work
I like rabbit holes!
could you expand a little on `f[-2]` - I can't seem to get that to work
Re: extracting part of {folder}
File.getAt() will give you the n-th path component. f[-2] is Groovy syntax for calling that method. -2 means 2nd element counting from the end. f[-2] is thus the same as f.dir.name and folder.name.