Chmod Multiple Directories via Terminal Script or Applescript

Hey everyone!
Im managing multiple labs and unfortunately need to change some directories on my workstations in order for my network users to access Applications with no errors. So i'm looking to create an Applescript or terminal script (not to fluent with terminal scripts yet) that will chmod 777 all of the directories I need to open. Can anyone help?
Does anyone how to prep a Applescript where I can just add in the directories that I need to modify?

I don't reccomend chowning any folder on a lab machine 777.
I manage over 700 macs in a university environment and almost no software requires that frivolous of a permissions scheme. most temp files will be written to the user's home directory, at most you want to set applications 0775, or 0755
but if you want to change the perms on a specific list of programs / folders then you can put all the names of each folder in a text file and loop through that
-------------this is your script------------------
#!/bin/bash
file="your text file"
for i in $( cat $file ); do
chown -R 0775 $i
done
---------------------------------

Similar Messages

  • How to pick files from multiple directories via Sender File Adapter?

    Hi guys,
    I have a scenario File to IDOC. The Sender File Adapter has to take all files: .xml from Source directory E://Current/.
    Actually directories are like
    E:/Plant1/Current/
    E:/Plant1/History/
    E:/Plant2/Current/
    E:/Plant2/History/.
    Can I have one Sender File Adapter to pick all *.xml files
    from
    E:/Plant1/Current/ and
    E:/Plant2/Current/  and how can I write it in Source Directory of Communication Channel?
    Or do I have to have a Sender File Adapter for each Plant?
    Any suggestion please?
    Kind regards,
    Danijela Zivanovic

    Hey
    You might wanna have a look at "Additional selection for source file" parameter in sender file adapter.
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/singleSenderFileCC4MultipleDirectories
    XI/PI: how to exclude files in a sender File adapter?
    Even though this method works but there are some constraints,please check help.sap.com for constraints.
    Thanx
    Aamir

  • How to do multiple shell scripts in AppleScript

    I got some solutions from previous posts on how to run sudo in Applescript, but there is still some minor syntax issues when I try to get to the destination directory. Usually in shell script I just type
    cd directory-destination
    in several lines to batch process those commands, but when I work with applescript, if I do do shell script for every "cd" command, instead of getting an overall result, I would get intermediate results individually.
    I read doc and learned that there might be a way to put commands together by using the & sign?
    Message was edited by: ttback

    An individual do shell script command runs in its own shell, so to perform multiple commands within that shell you need to combine them into a single statement. You can use the ampersand '&' operator to concatenate text strings, and the semicolon ';' to separate the commands, for example:set theFolder to "/Applications"
    do shell script "cd " & theFolder & "; ls -l ."See the technical note do shell script in AppleScript.

  • Bash script question, how do I create multiple directories on one line

    I am making a package for amavisd-new (yes I am aware that there is one in community but I can't say I like the way it is done).
    I have an install script from which I want to create multiple directories if they do not exist.
    So I want to create a directory /var/spool/amavis with subdirectories of var tmp virusmails spammassassin .
    I can't seem to be able to find a way to do this on one line.

    pelle.k wrote:
    peets wrote:Hehe because it's less typing!
    Good one!
    Also, it's by far the more dynamic method.
    If you want to get pedantic, it's also far less efficient in terms of execution time: each iteration of the loop forks a new process, whereas using a single mkdir command forks only once.  The "best" way is the curly-braces method demonstrated above by chimeric.

  • Shell script in Applescript

    I have a program that I run via Terminal, but I don't want a terminal window open while I run it (Just personal preference). I have an applescript set up to run the Terminal command, but the thing is that the command is "on" while the program is running, Is there some way that I can have the command go and then end the script wihtout closing the program? Or am I out of luck and have to have the Terminal window open?
    The program I am using is located here http://sites.google.com/site/sc2gears/
    Thanks for the help!

    The program is distributed (according to the docs) as a .command file, so you can get the efect you want like so:
    do shell script "/Users/yourname/further/path/Sc2gears-os-x.command &> /dev/null &"
    the &> /dev/null tells applescript that you don't care about any output, so it moves on to the next command, and the closing & sets the process up as a standalone.  Note:
    If the process doesn't close itself automatically you'll need a separate way of doing that
    if the process produces output you want to keep, don't use /dev/null - use an appropriate file path
    (obviously) '/Users/yourname/further/path' needs to be replaced with the correct path to the command, and needs to be single-quoted/escaped if it contains spaces or other unix-confounding characters

  • Send iMessages in OS X via Terminal

    Hello,
    i want to send pictures in iMessage via Terminal, Konsole / AppleScript.
    osascript -e 'tell application "Messages" to send "Hello World" to "John"'
    but there is an error:
    31:67: execution error: Messages got an error: Can’t make "John" into type buddy, text chat. (-1700)
    (John is a right contact)
    And how can I send pictures via Terminal?
    osascript -e 'tell application "Messages" to send "/pictures/pic01.png" to "John"'
    How can I tell OS X that I want to send a document and not a text?
    Thanks for your help!

    Hi,
    In the beginning iChat was AIM Only.
    Much of the AppleScript written for the app is written with this is mind.
    "picc-in-chars" are treated as Files whether they are sent as File Only with no Chat open or as Files within the Chat (which then displays the pics in most cases).
    The Auto Accept Script  may give some clues.
    It reads this for the Receipt of files and pic-in-Chats.
    To access this go to the Messages > Preferences > General section.
    At the bottom is  drop down for AppleScript with an option to show the Folder.
    This no longer displays the ~/Library/Scripts/Messages folder that Messages 7.x.x did (as did earlier version of iChat) that were used in the Alerts tab.
    If you open  the Script you can see it refers to "theBuddy" for some of the other Events.
    I am not sure this can be applied to the iMessages side of things.
    The Dictionary for Messages has this
    Your Script also appears to think you have a Pictures Folder at the top level of the Hard Drive (Along with Applications, Library, System, Users  etc.)
    Did you mean your home folder/Pictures (As In ~/Pictures)
    The Dictionary also defines "Buddies" as being related to specific Services
    this may include iMessages.
    I was once sent this script that displays  a Status messages that refers to who you are chatting with by using the name of the window (it has  section to exclued other windows)
    As text
    using terms from application "Messages"
        on av chat started
            tell application "Messages"
                set allChatWindows to every window
                set completed to false
                repeat with currentWindow in allChatWindows
                    set windowname to the name of currentWindow
                    if (not completed) then
                        if ((windowname is not ¬
                            "Audio/Video") and (windowname starts with ¬
                            "Audio" or windowname starts with ¬
                            "Video")) then
                            set status message to windowname
                            set completed to true
                        else if (windowname does not contain ¬
                            "General" and windowname does not contain ¬
                            "Doctor" and windowname does not contain ¬
                            "Activity" and windowname does not contain ¬
                            "File" and windowname does not contain ¬
                            "Accounts" and windowname does not contain ¬
                            "Messages" and windowname does not contain ¬
                            "Alerts" and windowname does not contain ¬
                            "Audio/Video" and windowname does not contain ¬
                            "Chax" and windowname does not contain ¬
                            "AIM" and windowname does not contain ¬
                            "Contacts" and windowname does not start with ¬
                            "Chat" and windowname does not contain ¬
                            "Chats" and windowname does not contain ¬
                            "Bonjour") then
                            set status message to "Audio Chat with " & windowname
                            set completed to true
                        end if
                        delay 0.2
                    end if
                end repeat
                set volume input volume 85
                delay 0.2
                set volume output volume 80
                delay 0.2
                set status to away
            end tell
        end av chat started
    end using terms from
    The end bit tweaks your volume Input and output from your regular settings.
    I hope that give you some clues.
    10:18 pm      Saturday; January 18, 2014
      iMac 2.5Ghz 5i 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • Automatically adjust display brightness via Terminal / Pretty good solution

    This hint is for all of you who experience any problem with the adjustment of the display brightness.
    *Short version*
    After a cold and/or warm start, it sometimes happens that the brightness was changed by the system itself to its dim power saver setting or maximum value and sometimes - what a big surprise - remains as it has been configured.
    I had spotted plenty of articles about this phenomenon, but none of them yielded a solution. I then decided to solve this problem by going the pragmatically way and use some kind of software which dims the display to my preferred setting. And the winner is: brightness.
    This tiny program works perfect and you will love its benefit by using it in terminal - yes, brightness is a command line utility. On top of this, brightness is able to control different displays, internal and external. The clou: beside using the precompiled binary you can also download the source code here, modify it to make the program fit your needs and then compile it using Xcode.
    1. Installation
    Download a precompiled version of the command line utility brightness here and extract the binary to your desired path (e.g. /usr/bin).
    2. Usage
    "brightness -l -v" dumps the current display attributes (-v for verbose mode) while "brightness 0.5" modifies the brightness of the main display to half of its max value and "brightness -m 1 1" let a second display become shiny. Just play little bit around.
    3. Automatically launch
    Simply create a .plist file and drop it, for example, in ~/Library/LaunchAgents. Or make use of an AppleScript or a Terminal Script to let it launch.
    That's it. Comments are welcome.
    *Long version*
    It seems to be, that the adjustment of the display brightness of an iMac and MacBook/Pro (maybe also other models are affected) drives a life of its own. After a cold and/or warm start, it sometimes happens that the brightness was changed by the system itself to its dim power saver setting or maximum value and sometimes - what a big surprise - remains as it has been configured.
    I had spotted plenty of articles about this phenomenon, but only found terms like "Did you already disabled the ambient light sensor", "Did you already reset the PRAM?", "Did you already reset the NVRAM?", "Did you already…BLAH". Far from it, all of these tips have one thing in common: none of them yielded a solution. As a last resort, I thought, it was a good idea to install 10.6 from the scratch just to find out that the above mentioned phenomenon occurs right after a few days of using OS X.
    I then decided to solve this problem by going the pragmatically way and use some kind of software which dims the display to my preferred setting. There are a few applications to do this, but always it was necessary to drag a slider or type in a value to dim the display, so none of them allowed an automatic configuration. No, I am not a very sophisticated person, I only prefer to use software which is simply well-thought-out. And the winner is: brightness.
    This tiny program works perfect and you will love its benefit by using it in terminal - yes, brightness is a command line utility. On top of this, brightness is able to control different displays, internal and external. The clou: beside using the precompiled binary you can also download the source code here, modify it to make the program fit your needs and then compile it using Xcode.
    1. Installation
    Download a precompiled version of the command line utility brightness here and extract the binary to your desired path (e.g. /usr/bin).
    2. Usage
    "brightness -l -v" dumps the current display attributes (-v for verbose mode) while "brightness 0.5" modifies the brightness of the main display to half of its max value and "brightness -m 1 1" let a second display become shiny. Just play little bit around.
    3. Automatically launch
    Sure, OS X provides different ways to launch a program automatically. If you are an enthusiast, feel free to use the one you prefer and stop reading, because you are already finished. If you are not that familiar to OS X take the next step as an advice.
    An easy way to trigger OS X launching a program automatically is to add the desired program to your Login Items. But, in this case, it will not work the easy way, because we have to launch a so called classic command line utility with a given option. It is not like starting Mail or iCal, which appears as typical applications to OS X. You must start brightness via Terminal by typing "brightness 0.5" (without quotes) to modify the main display brightness to half of its max.
    We now use a Launch Agent. Just create a .plist file, e.g. com.brightness.plist, with your favorite text editor. For the lazy ones here comes the template (simply copy and paste):
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Disabled</key>
    <false/>
    <key>Label</key>
    <string>com.brightness</string>
    <key>ProgramArguments</key>
    <array>
    <string>/usr/bin/brightness</string>
    <string>.5</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    </dict>
    </plist>
    Save the file in ~/Library/LaunchAgents, if you want brightness to be executed everytime you log in.
    You could also use an AppleScript. Copy and paste this code "do shell script "brightness 0.5"" (without the leading and closing quotes) to a new Script. Then choose Save As and enable the Option to make it Execute only. Now add the Script to your Login Items.
    Another option is to use a Terminal Script. Copy and paste this code
    #!/bin/bash
    /usr/bin/brightness 0.5
    exit 0
    and save it as, for example, brightness.sh. Make the Script executeable and add it to your Login Items.
    That's it. Comments are welcome.

    Thanks. Works great. I made a ScriptBundle and a User Agent (launchd) . So if someone sets the display brightness to maximum, it automaticaly corrects it at next login.
    The ScriptBundle contains your mentoined command line utility and the following applescript:
    do shell script quoted form of (POSIX path of (path to resource "brightness")) & " 0.7"
    Be aware of the space in " 0.7" or whatever value you have set.

  • HT2488 How do I create a workflow in Automator or a script in AppleScripts to download an excel file from a specific webpage?

    I would like to create a workflow in Automator or a script in AppleScript (or a combination of the two), that opens Safari to a specified page and downloads an excel file from this page and saves the downloaded document to my desktop.
    Is this something that be done? If so, how?
    I have so far been able to build a workflow in Automator to open Safari and added an AppleScript that takes Safari to a specific page that has an Excel document.
    I can't figure out where to go from here... Any help would be apprecitated.
    Thanks!

    Would you have the web address the excel sheet is on?
    Is there a simular web page you could point to if not?
    Would there be a copy of the file on an FTP page.  This would be easier. 
    curl
    http://www.cyberciti.biz/faq/mac-os-x-terminal-download-file/
    http://www.thegeekstuff.com/2012/04/curl-examples/
    http://curl.haxx.se/docs/manpage.html
    Macintosh-HD -> Applications -> Utilities -> Terminal
    # Press return to run a command.
    the curl is a terminal command ( Unix ).  It allows you to read a file off of the web.
    man curl
    provides cryptic information on the commnad curl.
    press the space bar to advance  a page.
    press letter to q to quit.
    What you may have to is to read in the web page as a text file.  Go "fishing" through the page to find the excel file you need.  Once you find the file, you can use curl to read the file.
    curl is a very full featured command.  (read complex to figure out ).
    It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on.  Here is an example.
        Author: rccharles
        For testing, run in the Script Editor.
          1) Click on the Event Log tab to see the output from the log statement
          2) Click on Run
        For running shell commands see:
        http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
    on run
        -- Write a message into the event log.
        log "  --- Starting on " & ((current date) as string) & " --- "
        --  debug lines
        set desktopPath to (path to desktop) as string
        log "desktopPath = " & desktopPath
        set unixDesktopPath to POSIX path of desktopPath
        log "unixDesktopPath = " & unixDesktopPath
        set quotedUnixDesktopPath to quoted form of unixDesktopPath
        log "quoted form is " & quotedUnixDesktopPath
        try
            set fromUnix to do shell script "ls -l  " & quotedUnixDesktopPath
            display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix
        on error errMsg
            log "ls -l error..." & errMsg
        end try
    end run

  • How can I enable java applet plug-in and Web Start applications via terminal?

    Since the last Java update to Snow Leopard, I have found that the system periodically disables the Java applet plug-in after a period of disuse.  I know I can go to /Applications/Utilities/Java Preferences and just click to re-enable Java.  But I want to write a script which will do this periodically for a couple hundred Mac users where I work. 
    My question is - how can I reenable the Java applet plug-in and web start applications via Terminal command?  Is this possible?  Is there a plist file that can be modified, etc.?
    Bob Reed

    It is my understanding that Apple's most recent Java update automatically disables Java after a certain period of time that it hasn't been used.  We don't want users to have to keep re-enabling it.  So we wanted to find a way to do this via script either run by a Casper JSS server or stored locally on each workstation.   With the guidance provided by Mark Jalbert above and some text from a script written by Rich Trouton, I was able to make a script (with some minor changes) and a launch agent to re-run the script upon login.  So the preference is always enabled.
    For your reference, the script content is:
    #!/bin/sh
    # DYNAMICALLY SET THE UUID FOR THE BYHOST FILE NAMING
    if [[ `ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-50` == "00000000-0000-1000-8000-" ]]; then
    MAC_UUID=`ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c51-62 | awk {'print tolower()'}`
    elif [[ `ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-50` != "00000000-0000-1000-8000-" ]]; then
    MAC_UUID=`ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-62`
    fi
    # Set the the "Enable applet plug-in and Web Start Applications" setting in the Java Preferences for the current user.
    /usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsEnabled" /Users/$USER/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UU ID}.plist
    /usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsEnabled bool true" /Users/$USER/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UU ID}.plist
    /usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsLastUsed" /Users/$USER/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UU ID}.plist
    /usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsLastUsed real $(( $(date "+%s") - 978307200 ))" /Users/$USER/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UU ID}.plist
    The launch agent plist content is:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
              <key>Disabled</key>
              <false/>
              <key>Label</key>
              <string>org.XXXXX.enableJavaPlugin</string>
              <key>ProgramArguments</key>
              <array>
                        <string>sh</string>
                        <string>/Library/Scripts/XXXXX/enableJava_plugin.sh</string>
              </array>
              <key>RunAtLoad</key>
              <true/>
              <key>StartOnMount</key>
              <true/>
    </dict>
    </plist>
    I hope this is helpful to anyone wishing to keep the Java web plugin enabled.
    Bob
    Message was edited by: Robert Reed2

  • Starting applications from a keynote via Apple Script?

    Is there any way to start an application from a keynote via Apple Script?

    Welcome to the forums!
    Keynote does not support the use of AppleScript in that fashion.

  • Installing STRUCTURE via Terminal

    I am attempting to install the program STRUCTURE via Terminal. I have installed other programs via Terminal w/ no problems. However, I now get the line:
    mkdir: /usr/local/Structure/: Permission denied
    I tried going into the script and replacing /usr/local w/ my own directory info. Permission is then not denied, however, the installation fails. What am I doing wrong?

    If you're not using sudo when you're running the installer, you need to use it.
    (42847)

  • CallManager Multitenant (Multiple Directories)

    As far as CallManager Multi Tenant goes, I am good with how to do everything except the directory part. From what I read, I can use the Cisco SDK (editing the XML) to say which directory each phone can see in the Corporate Directory. I'm trying to save myself a lot of research time here. Is there anyone who has been successful in creating multiple directories (using any method) and setting phones up to use these directories. I'm pretty savvy with scripting in both php/asp and I can even setup my own external directory if needed to pull from. I have full control over the system so there isn't anything I have to stay away from. any help is greatly appreciated. I am running CM 7.

    Yes. We have been successful using the "Open 79XX XML Directory".
    http://web.csma.biz/apps/xml_xmldir.php
    We are running multiple instances of this, one per tenant: one MySQL database and one XML directory URL per tenant.

  • Mounting multiple directories with same name on different severs to a single mount point on another server

    We have a requirement where in we have multiple solaris servers and each solaris server has a directory with the same name.
    The files in these directories will be different.
    These same name directories on multiple severs has to be mounted to a single directory on another sever.
    We are planning to use NFS, but it seems we can not mount multiple directories with same name on different severs to a single mount point using NFS, and we need to create multiple mount points.
    Is there any way we can achieve this so that all the directories can be mounted to a single mount point?

    You can try to mount all these mount points via NFS in one additional server and then export this new tree again via NFS to all your servers.
    No sure if this works. If this works, then you will have in this case just an additional level in the tree.

  • Compressor via Terminal

    Does anyone know, how to start compression via terminal command?
    For example: ./compressor -somepreset_name_oroptions input_file output_file
    I need to do automatic compression of all files in some directory. And want to write some script, that monitor this directory for new files. But i don't know how to start compression from that script.

    Strongly suggest posting to the Unix forum under OS X Technologies where the Unix/Terminal gurus hang out.

  • Trying to minuplate UPnP in my router via terminal

    Hey guys, I have a program I have a program I want to run which requires a few specific ports to be open, when I'm at my friends house or my families house I don't have access to their router and don't feel like Master Resetting their Router as they almost always forget the password (Never left default) So I'm just stuck doing nothing, so I want to find a program to allow me to send requests to the router itself which has UPnP enabled, so I can open whatever ports I need at that time, or a way for me to do it via terminal so I can just write an automated script
    I looked up: UPnP Router Control, which is out of date, so it failed to install.
    A program to do it is ok, but personally I would like to find a command which would allow me to do it myself so I can just write a script, but even with all my google searching I have not been able to find anything yet. Also, issue is not with any firewall on my computer, all that is managed correctly.
    Thanks for any help!!
      ~Kitkin15
    Last edited by Kitkin15 (2014-07-02 01:07:38)

    A quick repo search pointed me to the upnpc utility, it's part of  community/miniupnpc.

Maybe you are looking for