New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access is Denied when trying to os.rename a file #29106
Comments
This is very unlikely to be a problem with Go. Are you able to run
while running as the same user as the Go program? |
Tried it on Cmder bash and cmd and same result: |
When I wrote |
When I try this command: But, when I try "mv test.txt /c/srv/file-storage/testdir/" it moves it with no problem |
I tried changing the "server-directory" to C:/srv/file-storage/testdir or /c/srv/file-storage/testdir but still the same issue |
I found what was my problem! I dont know how i havent tought about it before but Im glad I did, finally I can go to sleep :) |
@LinkyDev Thanks for following up. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
main.go https://play.golang.org/p/byFvCdNZ6WA
server-config-handler.go https://play.golang.org/p/NT0YNaDCzfh
server-config.json https://play.golang.org/p/f0MMU9F7t6-
Im trying to create an http website server that has the ability to upload files and save them on the server storage
After troubleshooting for 2hours I believe the problem is somehow connected to the os.Rename permission (Im a new Go programmer so I dont know for sure)
What did you expect to see?
Expected to see the newly created file moved to the "/srv/file-storage/testdir/" folder
What did you see instead?
2018/12/05 02:34:58 test.txt
File created succesffuly
2018/12/05 02:34:58 Wrote 617 bytes.
2018/12/05 02:34:58 rename test.txt /srv/file-storage/testdir/: Access is denied.
2018/12/05 02:34:58 An error occurred while renaming the file directory! ERROR:004
exit status 2
The text was updated successfully, but these errors were encountered: