James, if I understand right, for this you need the canXXX methods of File, which is a standard Java API (all Java APIs are directly accessible from Groovy):
https://docs.oracle.com/javase/8/docs/api/index.html?java/io/File.html I doubt there's a groovier way for that, but of course I might be missing something. All the best, OC > On 15. 10. 2021, at 13:49, James McMahon <[email protected]> wrote: > > Hello. I am trying to convert an existing script from python to Groovy. It > executes a number of os.path and os.access commands, which I've not yet been > able to find examples of that are written in Groovy. I have found similar > implementations that employ "add on" Jenkins libraries for Groovy, but I will > not have access to such libraries.Here is a brief excerpt from what I now do > in python. Has anyone done similarly in Groovy? Can I impose for an example? > > Thanks very much in advance. Here is my python: > > if ( os.path.exists(result['thisURL']) and os.path.isfile(result['thisURL']) > ) : > if ( os.access(result['thisURL'], os.F_OK) > and os.access(result['thisURL'], os.R_OK) > and os.access(thisDri, os.W_OK) > and os.access(thisDir, os.X_OK) ) : > # do some stuff > else : > # dir and file not accessible, do some different stuff >
