I have the following problem.
I need to replace a file with another one. As far as the new is transfered over the network, owner and group bits are lost.
So I have the following idea. To save current permissions and file owner bits and than after replacing the file restore them.
Could you please suggest how to do this in Python or maybe you could propose a better way to achieve this.