Automatically Inhibit sleep while transferring files over the network?

Solution 1:

You can install 3rd part app Caffeine. you can turn it on to prevent your mac from sleeping. Other popular apps are Anti Sleep and Amphetamine. I'm pretty sure all 3 are free. Amphetamine is also available from the App Store. I personally use Caffeine and it works well. It adds a coffee cup icon to menu bar so you can easily turn it on or off.

Caffeine may actually come with newer system upgrades so check your Applications folder.

Solution 2:

I am not sure how familiar you are with it, but the terminal command caffeinate will keep your computer from sleeping. This lets you add it as part of a script, and doesn't rely on third party applications (Caffeine just runs that command anyway, it's not adding any functionality that didn't already exist).

This way, you can activate it when transferring files, either manually or part of some automated workflow (eg. a bash script or with Alfred workflows, etc.)