Quite a few years ago Microsoft recognized that with windows copy and xcopy commands had some serious inadequacies. They therefore created robocopy <https://ss64.com/nt/robocopy.html> as a replacement, and it has shipped in all modern versions of Windows. At any rate it's something I think we should support. Unfortunately it has a couple of wrinkles. First, it actually returns non-zero in most success conditions. See <https://ss64.com/nt/robocopy-exit.html> That can be handled by calling it via a script. But the other thing is that the calling syntax is different. It's "robocopy sourcedir destdir filename" It doesn't allow for files to be renamed, but luckily we don't normally need it to. However, what we do need is the ability to get the directory name from the %p parameter for archive_command and restore_command, stripped of the actual file name. I therefore suggest in both cases we implement a %P escape to allow for it. Should be a pretty tiny patch.
cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com