fixes #2792 - only touch if writable
Merge pull request #2797 from owncloud/fixing-2792-master

fixes #2792 - only touch if writable