File rename - permision denied

73 views
Skip to first unread message

vuk...@gmail.com

unread,
Jan 13, 2014, 7:08:35 AM1/13/14
to rubyonra...@googlegroups.com
Hi

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.

Thanks.

Darko

James Turley

unread,
Jan 13, 2014, 7:36:02 AM1/13/14
to rubyonra...@googlegroups.com
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.


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d0d5aa70-eb57-4a87-8730-61328c44d9fa%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Rick

unread,
Jan 13, 2014, 8:49:32 AM1/13/14
to rubyonra...@googlegroups.com
When changing a file's name you need to have write permission on the containing directory.

vuk...@gmail.com

unread,
Jan 13, 2014, 5:28:33 PM1/13/14
to rubyonra...@googlegroups.com, jamestu...@googlemail.com
Hi

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".

Rick

unread,
Jan 13, 2014, 7:13:40 PM1/13/14
to rubyonra...@googlegroups.com, jamestu...@googlemail.com
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.
Reply all
Reply to author
Forward
0 new messages