Added code to check if you have access to copy the file