This fix gathers the share keys BEFORE a file is moved to make sure that
findShareKeys() is able to find all relevant keys when the file still
exists.
After the move/copy operation the keys are moved/copied to the target
dir.
Also: refactored preRename and preCopy into a single function to avoid
duplicate code.