Copy/Replace Preference File Based on Condition

I'm trying to work with After Effects to mount a specific cache drive if it exists. If it doesn't exist and AE launches, it forces me to reset the cache location. Each time I launch with the drive connected after a reset, I have to manually change the cache location.

So far, I think I've gotten the actual macro right for checking for the drive, now I just need to solve for the cache location.

Is there a way to copy a preference file to a folder and overwrite the current file based on a condition?

For example, if I launch the macro and the drive isn't found, a preference file with the default cache path is copied over before AE launches. If the drive is found, a different preferences file with paths to the external drive is copied.

Either way, the file is copied and overwrites the existing file, ideally without prompting me to replace it.

Any help would be appreciated. Thanks!

Note: As for the macro itself, when launched, it looks for the external volume and if found, KM mounts it. Once it is mounted, AE launches. If it can't be found or mounted, the macro times out and AE is launched without the drive.

See:

What more do you need to know?