How can I add account privileges to a newly created file?

I have multipe accounts on my Mac.  Two of them need to share certain files, but not with everyone else so I can't use the Shared folder.  When I create a new text file with AppleScript it has default ownership to the account that created it, but I need to give read & write privilages to it to the other account as well.  I can do this manually, but there are lots of files sometimes.  One trick I've found is to reset privilages from the next higher folder.  This saves time, but sometimes I forget.  Also when I do this it causes Time Machine to think all the files in that folder have been updated.  If the folder is large it may cause Time Machine to purge a old backup version.  What I'd like to do is find some AppleScript code I can use to add user "A" with read & write access to the permissions of a new file at the time my AppleScript creates that file.  Any ideas?

Thanks for the reference.  It was interesting and provided me with a direction I hadn't thought of: User Groups and Terminal commands which led to DO SHELL SCRIPT.
The approach in your reference wasn't practical for me because I already have about 10,000 folders in a 4-deep tree structure on a 2 TB hard disk.  The inheritance method whould have taken a lot of work.
I did some more researching and experimentation and here's what I ended up with.
First I created a User Group and assigned the two accounts that needed to share files to it.  By the way, I have two accounts so I can run time-consuming AppleScripts in one while doing work in the other.  This way I'm not disturbed by the AppleScripts and, since some of them use System Events, they aren't disturbed by me.  Anyway, I set up a User Group.  For some reason, the first group didn't work properly.  When I assigned it to a folder or file, one of the account names appeared next to the group icon in the Get Info window of Finder.  I tried everything I could think of to make it work and failed.  Then I created a second User Group and it worked fine, so I just deleted the first group.  I wonder what went wrong the first time?
Next I used the Finder's Get Info window to apply the new Group privilages to all items in my very large shared data folder on that hard drive.  This took about an hour.
Finally I created the following AppleScript code taking most of it from what I found on the Internet and fixing problems using other things found on the net.  I've built the following code into a number of AppleScripts that create folders containing 20-200 files.  I've run two of the scripts and created about 200 files in a few dozen folders and it seems to work fine.  Oh, one more thing: For some reason I couldn't assign group membership by name.  I kept getting an error message.  When I substitued the group number - 505, it worked fine.  Go figure!
tell application "Finder"
... lots of finder code ...
set these_items to every item in folder (target_folder & folder_name)
tell me
                                        set this_POSIX to quoted form of POSIX path of ((target_folder & folder_name) as alias)
                                        do shell script "chown -R  " & "Programming:505 " & this_POSIX user name "Richard" password "xxx" with administrator privileges
                                        do shell script "chmod -R 770 " & this_POSIX user name "Richard" password "xxx" with administrator privileges
                                        repeat with this_item in these_items
                                                  set this_POSIX to quoted form of POSIX path of (this_item as alias)
                                                  do shell script "chown -R  " & "Programming:505 " & this_POSIX user name "Richard" password "xxx" with administrator privileges
                                                  do shell script "chmod -R 770 " & this_POSIX user name "Richard" password "xxx" with administrator privileges
                                        end repeat
                              end tell
...more finder code
end tell
Note: The tell me was recommended by someone on the net.  There was a caution about do shell script failing inside a Tell application "Finder".  I didn't test this.
I'm a happy camper now.  I don't think I'd have found my way without the reference you provided.

Similar Messages

  • How can I add a photo to a newly created photo book it the photo wasn't in the album I made the book from? thnx

    how can I add a photo to a newly created photo book it the photo wasn't in the album I made the book from? thnx

    Drag it to the book project in the source pane on the left
    LN

  • Using the value "Image/*" for the accept attribute of the HTML input Element, how can I add .pdf to the array of preconfigured file types (.jpe, .jpg, .jpeg, .?

    On a form, using the value "image/*" for the accept attribute of the HTML input Element, how can I add .pdf to the array of pre-configured file types (.jpe, .jpg, .jpeg, .gif, .png, .bmp, .ico, .svg, .svgz, .tif, .tiff, .ai, .drw, .pct, .psp, .xcf, .psd, .raw)?
    Say I wanted to add .gif, .jfif or .ico. I find this array limited, how can I add types to image?
    <input type="file" name="file" accept="image/*" id="file" />
    mimeTypes.rdf does not seem to allow this.

    ''mimeTypes.rdf'' has nothing to do with web development. It's a file that stores your file handling preferences (e.g. if you want ZIP files automatically saved or opened).
    You can't change the file types of the pre-defined content specifiers (audio/*, video/*, image/*), but you can specify additional MIME types. To add PDF to your above example,
    <pre><nowiki><input type="file" name="file" accept="image/*,application/pdf" id="file" /></nowiki></pre>
    For details, see
    * [https://developer.mozilla.org/En/HTML/Element/Input developer.mozilla.org/En/HTML/Element/Input]

  • How can I add links to open xml and csv files stored in another location? Please advice how to place links in my frame maker document?

    Hi,
    I would like to know as to how can I add links to open xml and csv files stored in another location? Please advice how to place links in my frame maker document?
    Kindly advice.
    Thanks
    Priya

    Special > Hypertext > Command "open document" will do its best to open the target document inside FrameMaker, which may not be much help; Special > Hypertext > Command "message …" will use the application you specify. The user guide for 7.0 says this about absolute links, and I don't think anything has changed since:
    For example, to start PaintBrush and open the Ship.pcx file on drive C you would use the command message system pbrush.exe C:/Ship.pcx
    I've not often used a relative link, and not recently: the same source says
    folder levels are separated by a slash / even in Windows and Mac
    [relative links] FrameMaker searches for a relative pathname beginning in the folder that contains the current document
    [absolute links] FrameMaker searches for an absolute pathname beginning at the top of the file system. In Windows, the absolute pathname begins with the drive specifier, a colon and a slash.

  • How can i add smiley or special character when creating new contacts?

    how can i add smileys or special character when creating a contact on my contacts? help please...

    I think you need to download an app for that - do a search in the app store.

  • How can I Add Account in Mail, Contacts, Calendars

    On my Ipad Mini, Under Settings, my "Mail, Contacts, Calendars" brings me to its main page. All of my accounts are grey, inactive. I can't select the Icloud, gmail or add account?!!
    This also applies to my Facebook setting. Help!
    Thanks.

    Settings>General>Restrictions>Allow Changes>Accounts. Check that setting. If you restricted changes to accounts, those items will be greyed out and inaccessible.

  • How can I add a custom attribute to the create page dialog?

    I followed the following link to add a custom attribute called starred and this attaribute can be displayed in siteadmin grid
    http://dev.day.com/docs/en/cq/current/developing/customize_siteadmin.html
    I would like to let the user input the value when they create a page. That's why I would like to add a custom field in the input dialog box as attached pic.
    The method you describe before can only added those CQ bulid-in attribute.
    For those custom attribute, how can I added it?

    Hi,
    How can I customize the /bin/wcmcommand or how can I make use of [2] to create a custom WCMCommand?
    I think the "formUrl" is to post those input value to the jcr repository?
    var createDialog = {
            "jcr:primaryType": "cq:Dialog",
            "id": CQ.Util.createId("cq-createdialog"),
            "title":CQ.I18n.getMessage("Create Page"),
            "formUrl": CQ.shared.HTTP.externalize("/bin/wcmcommand"),
            "params": {
                "cmd":"createPage",
                "_charset_":"utf-8"
    I have added a field called "starred"
    Moreover, when I using the firebug to trace the post command, I can see that the starred value is posted also.
    :status
    browser
    _charset_
    utf-8
    cmd
    createPage
    label
    b
    parentPath
    /content/keyword_elaboration
    starred
    c
    template
    /libs/collab/commons/templates/form
    title
    a
    Source
    cmd=createPage&_charset_=utf-8&%3Astatus=browser&parentPath=%2Fcontent%2Fkeyword_elaboration&title=a&label=b&starred=c&template=%2Flibs%2Fcollab%2Fcommons%2Ftemplates%2Fform
    However, when I go to the crxde to view the node's attribute, the properity starred is not created
    Are there anything I did wrong or missing?
    Thanks.
    Message was edited by: aslkit

  • How can I add an expiration date to a pdf file?

    How can I apply an expiration date to a pdf document in Acrobat Pro X? Can this be done in Acrobat XI?

    Read this:
    http://forums.adobe.com/thread/1085319?tstart=0

  • How can I add ?xml-stylesheet to an XML file?

    Hi guys,
    I have a java code that writes out an XML file. I want to specify the name of a stylesheet in the XML file. How can I do that?
    This is the source code I have:
    //---------- Create XML File ------------------
    private void createXMLFile(Document doc) throws Exception
    try
    TransformerFactory tF = TransformerFactory.newInstance();
    Transformer tr = tF.newTransformer();
    FileOutputStream outXml = new FileOutputStream(xmlFile, false);
    tr.transform(new DOMSource(doc), new StreamResult(outXml));
    outXml.close();
    catch (java.io.FileNotFoundException exc)
    throw new Exception(exc.getMessage());
    catch( TransformerConfigurationException exc )
    throw new Exception(exc.getMessage());
    catch( TransformerException exc )
    throw new Exception(exc.getMessage());
    Thank you
    Murat

    The solution from dvohra09 will output a file outXml that uses the format rules from stylesheet.
    But how can I write out the following 2 lines to outXml? contextHandler.startDocument() will only write out the first line, but not the second line...
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="mytest.xsl"?>
    Thanks for all pointers!
    Philip

  • How can I add an extra in pages when creating a newsletter?

    Hi,
    I'm working on a newsletter in Pages via the newsletter template (I'm working in 5.2) it won't however let me add an extra page, I just have the two that are in the original template.
    Any ideas?
    Thanks.

    Hi Chl0w,
    In layout mode (again, Pages 5.x) you can use Insert (Page) from the menu bar or toolbar.
    Pages Help for Mac, Add, delete, and rearrange pages
    Add a page
    In a page layout document: Click Insert   in the toolbar, then choose Page.
    The new page appears at the end of the document.
    In a word-processing document: Add a page break. You can also add a section that begins on a new page.
    Take care,
    Nubz

  • How can I add random mail signatures from a text file?

    I'm trying to add a different quote to every email that I write... is there a program or way for Mail to pluck and append a quote at random from a external file of quotes?  (I'm not talking about the standard "Random" feature built into Mail.)
    There must be one out there, but I can't find it.  I'm using Snow Leopard and Mail 4.5

    Hello,
    Here is a running start on getting specific lines in the case lines starting with ComboBox. I took your data and placed it into a text file named TextFile1.txt in the bin\debug folder. Code below was done in
    a console app.
    using System;
    using System.IO;
    using System.Linq;
    namespace ConsoleApplication1
    internal class Program
    private static void Main(string[] args)
    var result =
    from T in File.ReadAllLines(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TextFile1.txt"))
    .Select((line, index) => new { Line = line, Index = index })
    .Where((s) => s.Line.StartsWith("ComboBox"))
    select T
    ).ToList();
    if (result.Count > 0)
    foreach (var item in result)
    Console.WriteLine("Line: {0} Data: {1}", item.Index, item.Line);
    Console.ReadLine();
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my webpage under my profile but do not reply to forum questions.

  • How can i  add entry in table BSP_DL_XMLSTRX2 for creating a copy of a view

    hi
    i want to copy in a CRM_UI component view the configuration of the view and want to save the copy with a
    different object type. But F4 value help only provides ( in crm_ui component workbench) me the value <DEFAULT> as for that view there is only one entry in table
    BSP_DL_XMLSTRX2 and for object type = <DEFAULT> and when i enter something different i get the error that this object type does not exist.
    (call method CL_BSP_DLC_XML_STORAGE2=>GET_EXISTENCE_FOR_VIEW
        exporting
          IV_COMPONENT       = ME->CURRENT_CONFIG_KEY-COMPONENT
          IV_VIEWNAME        = ME->CURRENT_CONFIG_KEY-VIEWNAME
        importing
          ET_CONTEXT_SEM_KEY = LT_CONTEXT
          ET_CONFIG_INFO     = LT_CONF_INFO.
    ---> result in only one line but i want to add another
    *so my questioin:
    where can i enter a new object type for a existing crm_ui view configuration

    Hello Britta,
    Its useful program to copy a view configuration.
    Best Regards,
    zafer,
    Edited by: Zafer Kuru on Dec 5, 2011 3:51 PM
    REPORT  z_copy.
    TABLES bsp_dcls_conf_semantic_key.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS     fr_comp  TYPE bsp_wd_component_name OBLIGATORY.
    PARAMETERS     fr_view  TYPE o2pageext OBLIGATORY.
    PARAMETERS     fr_role  TYPE bsp_dlc_role_key OBLIGATORY.
    PARAMETERS     fr_couse TYPE bsp_dlc_component_usage OBLIGATORY.
    PARAMETERS     fr_obty  TYPE bsp_dlc_object_type OBLIGATORY.
    PARAMETERS     fr_obsty TYPE bsp_dlc_object_sub_type OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS     to_comp  TYPE bsp_wd_component_name OBLIGATORY.
    PARAMETERS     to_view  TYPE o2pageext OBLIGATORY.
    PARAMETERS     to_role  TYPE bsp_dlc_role_key OBLIGATORY.
    PARAMETERS     to_couse TYPE bsp_dlc_component_usage OBLIGATORY.
    PARAMETERS     to_obty  TYPE bsp_dlc_object_type OBLIGATORY.
    PARAMETERS     to_obsty TYPE bsp_dlc_object_sub_type OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    PARAMETERS     request   TYPE trkorr OBLIGATORY.
    PARAMETERS     d_mode    TYPE flag.
    SELECTION-SCREEN END OF BLOCK b3.
    DATA :  iv_from_component         TYPE  bsp_wd_component_name,
            iv_from_viewname          TYPE  o2pageext,
            iv_from_role_key          TYPE  bsp_dlc_role_key,
            iv_from_component_usage   TYPE  bsp_dlc_component_usage,
            iv_from_object_type       TYPE  bsp_dlc_object_type,
            iv_from_object_sub_type   TYPE  bsp_dlc_object_sub_type,
            iv_to_component           TYPE  bsp_wd_component_name,
            iv_to_viewname            TYPE  o2pageext,
            iv_to_role_key            TYPE  bsp_dlc_role_key,
            iv_to_component_usage     TYPE  bsp_dlc_component_usage,
            iv_to_object_type         TYPE  bsp_dlc_object_type,
            iv_to_object_sub_type     TYPE  bsp_dlc_object_sub_type,
            is_transport_data         TYPE  bsp_dlc_config_transport_data.
    DATA:
      ls_from_config_data   TYPE bsp_dlcs_conf_data,
      lr_from_text_rep      TYPE REF TO cl_bsp_dlc_stext_repository2,
      lr_to_text_rep        TYPE REF TO cl_bsp_dlc_stext_repository2,
      lt_from_text          TYPE bsp_dlt_stxtrep2,
      ls_from_text          TYPE bsp_dl_stxtrep2,
      lv_to_context_id      TYPE bsp_dlc_context_id,
      lv_config_data_origin TYPE bsp_dlc_config_data_origin.
    DATA lt_xmlconf TYPE TABLE OF bspc_dl_xmlstrx2.
    DATA ls_xmlconf TYPE bspc_dl_xmlstrx2.
    DATA ls_xmlconf_check TYPE bspc_dl_xmlstrx2.
    is_transport_data-request = request.
    is_transport_data-display_mode = d_mode.
    SELECT SINGLE * FROM bspc_dl_xmlstrx2 INTO ls_xmlconf_check
                                          WHERE component = fr_comp
                                            AND viewname = fr_view
                                            AND role_key = fr_role
                                            AND component_usage = fr_couse
                                            AND object_type = fr_obty
                                            AND object_sub_type = fr_obsty.
    CHECK sy-subrc EQ 0.
    TRY.
        CALL METHOD cl_bsp_dlc_xml_storage2=>get_config_data
          EXPORTING
            iv_component           = fr_comp
            iv_viewname            = fr_view
            iv_role_key            = fr_role
            iv_component_usage     = fr_couse
            iv_object_type         = fr_obty
            iv_object_sub_type     = fr_obsty
            iv_only_spec_parameter = abap_true
          IMPORTING
            es_config_data         = ls_from_config_data
            ev_config_data_origin  = lv_config_data_origin.
      CATCH cx_bsp_dlc_config_not_found.
        RAISE config_not_found.
    ENDTRY.
    lr_from_text_rep = cl_bsp_dlc_stext_repository2=>get_instance(
                                             iv_component = fr_comp
                                             iv_viewname  = fr_view
                                             iv_role_key        = fr_role
                                             iv_component_usage = fr_couse
                                             iv_object_type     = fr_obty
                                             iv_object_sub_type = fr_obsty
    CASE lv_config_data_origin.
      WHEN cl_bsp_dlc_xml_storage2=>config_data_origin_c.
        CALL METHOD lr_from_text_rep->get_texts_c_for_context_id
          EXPORTING
            iv_all_langu = 'X'
          IMPORTING
            et_text      = lt_from_text.
      WHEN cl_bsp_dlc_xml_storage2=>config_data_origin_s.
        CALL METHOD lr_from_text_rep->get_texts_s_for_context_id
          EXPORTING
            iv_all_langu = 'X'
          IMPORTING
            et_text      = lt_from_text.
    ENDCASE.
    Edited by: Zafer Kuru on Dec 5, 2011 3:54 PM

  • HT5538 I have a different phone number when traveling, that the one registered in my account. How can I add it?

    I have a different phone number when traveling, that the one registered in my account. How can I add it?

    Lost information
    https://www.adobe.com/account.html for serial numbers or subscriptions on your Adobe page... or
    Lost serial # http://helpx.adobe.com/x-productkb/global/find-serial-number.html

  • I am trying to manage family sharing and I get a warning "invalid apple ID" that accounts can participate in one Family at a time.  How can I add my daughter when I can't even access my account?

    I am trying to manage family sharing and I get a warning "invalid apple ID"  accounts can participate in one Family at a time.  How can I add my daughter when I can't even access my account?

    Your best bet would be to try resetting the password to the account that you would like to use via iForgot
    Once you log in to that account change the email address to anything, it can even be fake its just a placeholder
    After you do that you will be free to change your old email address on your appleID to the new one that is now free to be used as it is no longer attached to the other account.

  • HT201493 How can I add my daughter to Find my friends when we have the same itunes account and that's how they make us log in?

    How can I add my daughter to Find my friends when we have the same itunes account and that's how they make us log in?

    1) You asked "Does she need to reconnect to that itunes/computer and if so what do we need to do to remove this folder of pics from her ipod?" Yes, you have to connect the iPod to that computer and go to the Photos pane for the iPod in iTunes and uncheck sync photos and the click on synce/apply. In the future do not check sync photos.
    iOS and iPod: Syncing photos using iTunes
    2)
    Create a NEW account for using these instructions. Make sure you follow the instructions. Many do not and if you do not you will not get the None option. You must use an email address that you have not used with Apple before.
    Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card
    Then on the iPod go to
    - Settings>Messages>Send and receive and sign out your ID and sign into hers. Make sure that only her ID email address is listed.
    - Settings>FaceTime sign out of your ID and sign into hers. Make sure that under You can be reached at only her ID email address is listed
    - Settings>iCloud and sign out and sign in with hers
    Contnue to use the commpn ID/account for Settings>iTunes and App stores.

Maybe you are looking for

  • Query to pull out Vendor details with AP invoice

    Hi all I have made the following query to pull out the following data House Bank Account, Customer/Vendor Name,Payment Method code,Default Account,Default Branch,Default bank Internal id, Document NUmber,Customer/Vendor Ref No,Row Total,Item/Service

  • [SOLVED] Install Galago ultrapro with intel 7260 (rev 73)

    Hi, Has anyon had any luck getting this wireless to work. It connects to my access point, and then times out on pacstrap. This freezes my access point. No problems with other wireless devices. Thanks Last edited by forshark (2014-03-25 23:00:46)

  • Adobe reader printer list not showing

    while printing the PDF File, windows  printers are not showing in the printer list. Where as windows printers are working in Word/Wordpad/notepad.

  • How can i confirm that i have the grid control ?

    Hi, I have oracle 10g database , we have dbconsole. But i don't know wherther we have the grid control or not ??? how can i check that ?? And one more thing , i have the oracle 817 databases , in need to register that database into the GRID . Can any

  • Scenario regarding Split Valuation

    Dear Experts, I have a scenario related to materials having Split Valuation.I have Material Master having Valuation Types :  Good_Stock,Refurbished_Stock & Defective_Stock.There is no issue with Valuation Types Good_Stock,Refurbished_Stock as they sh