How to execute muliple commands in a single EXEC task

I am new to Gradle development. I have come across a requirement where i need to run muliple commands (for eg: “ls -a” and “mkdir sample”) in a single Exec task. Can any of you please guide me?

Either use shell features such as ‘&&’, or write a shell script, or use multiple ‘Exec’ tasks. Things like ‘ls’ and ‘mkdir’ are usually better done in Gradle/Groovy (e.g. ‘println file("…").listFiles()’, ‘project.mkdirs("…")’).

Thanks for the response Peter.