[encryption] define type in pre hook

Define type of renamed file/folder in pre hook instead of checking the encryption key path in the post hook.

Cleaner and more robust solution but not a urgent bug fix.