I want to change the filename with File.rename but I get “Permission denied” eve if I change the file with File.chmod(-777, “path/filename”)
I want to do this, to change the name of the image uploaded by Paperclip.
If you have any sugestion or solution, write me.
File.chmod will presumably only work if your Ruby process is being executed by a user with the required permissions to run chmod in the first place; I suspect not in this case. Change the permissions on the directory with your files in so that user can access it, using the shell.
When changing a file’s name you need to have write permission on the containing directory.
I changed the permissions of the directory from my command prompt (using Windows). Used this command:
cacls path\folder /t /e /g Everyone:f
And I got the same message “Permission Denied”.
didn’t realize you were on a windows box - life can be somewhat less rational there. unix has used the same permissions model and change commands since it’s inception in 1970. calcs showed up sometime around windows2000/xp and has now been depricated for use on windows7.
here’s a thread that you might find helpful; http://stackoverflow.com/questions/9113206/cacls-windows-7-full-permissions-local-names
you could save yourself much heartache (measured in decades) and build yourself a linux box. microsoft does not make a software development environment, they only make money.