It depends where you are running the application. Locally, you can do this, but if you deploy it to the Mendix Cloud it won't work because of the security restrictions. I wouldn't recommend trying to access files outside the resources folder.
What is your use case? There may be a different approach you can take such as using the SFTP module to copy files to an external location.