Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 405823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:26:11+00:00 2026-05-12T17:26:11+00:00

I need to delete an application (MyApp.app), which has read only permissions in all

  • 0

I need to delete an application (MyApp.app), which has read only permissions in all its enclosed folders. Before I delete it, I should change the permissions on all enclosed files/directories to 0644. How do I do this recursively?

I’ve tried

begin; FileUtils.chmod(0644, '#{config.appPath}'); rescue; end
begin; FileUtils.rm_r('#{config.appPath}'); rescue; end

but FileUtils.chmod doesn’t work recursively. I cannot use Unix commands – it has to be Ruby.

EDIT: I cannot use Unix commands in the current context. OK, this is a RubyCocoa application and the source you see is a part of ruby script, that is supposed to uninstall the application (please don’t comment on that, since that’s the code my customer has). Uninstalling includes removing all traces of the application, killing the process and in the end deleting the application itself. Normally it works, but not in the case when for some reason the MyApp.app folder gets read only permission. So i thought to run a chmod recursively on the folder and them remove it, but it’s not straight forward in Ruby for some reason.
That’s why i’m asking for a help. There are plenty examples on how to do it from a command line, but how do you do it from the code?

Here some more from the code, just to show how’s it implemented:

code =<<FOO
require 'fileutils'
# kill the app before deleting files in case it writes files on exit
%x{/bin/kill -9 #{NSProcessInfo.processInfo.processIdentifier}}
begin; FileUtils.chmod(0644, '#{TBConfig.appPath}'); rescue; end
begin; FileUtils.rm_r('#{TBConfig.appPath}'); rescue; end
FOO
    ff = Tempfile.new('timebridge')
    ff.write(code)
    ff.close
    %x{/usr/bin/ruby #{ff.path}}

Thanks again.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T17:26:11+00:00Added an answer on May 12, 2026 at 5:26 pm

    FileUtils.chmod_R should do it

    http://www.ruby-doc.org/core/classes/FileUtils.html#M004351

    — EDIT —

    seth@oxygen ~ $ mkdir -p foo/bar/seth
    
    seth@oxygen ~ $ ls -ld foo
    drwxr-xr-x  3 seth  staff  102 Oct 15 19:24 foo
    
    seth@oxygen ~ $ ls -ld foo/bar
    drwxr-xr-x  3 seth  staff  102 Oct 15 19:24 foo/bar
    
    seth@oxygen ~ $ ls -ld foo/bar/seth
    drwxr-xr-x  2 seth  staff  68 Oct 15 19:24 foo/bar/seth
    
    seth@oxygen ~ $ cat test.rb
    require 'fileutils'
    begin; FileUtils.chmod_R(0777, 'foo'); rescue; end
    
    seth@oxygen ~ $ ruby test.rb
    
    seth@oxygen ~ $ ls -ld foo
    drwxrwxrwx  3 seth  staff  102 Oct 15 19:24 foo
    
    seth@oxygen ~ $ ls -ld foo/bar
    drwxrwxrwx  3 seth  staff  102 Oct 15 19:24 foo/bar
    
    seth@oxygen ~ $ ls -ld foo/bar/seth
    drwxrwxrwx  2 seth  staff  68 Oct 15 19:24 foo/bar/seth
    

    A quick test appears to work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 250k
  • Answers 250k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use the :first selector: $('p:first'); May 13, 2026 at 9:15 am
  • Editorial Team
    Editorial Team added an answer Just use CSS. .myclass { text-transform:capitalize; } May 13, 2026 at 9:15 am
  • Editorial Team
    Editorial Team added an answer UPDATE t1 SET t1.field1 = t2.field2Sum FROM table1 t1 INNER… May 13, 2026 at 9:15 am

Related Questions

I am writing php web applications, and simply deploy them via FTP. To make
I am developing an application that saves its settings in the install folder. If
I want to spawn another process to display an error message asynchronously while the
Is it possible to make an application in C# that will be able to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.