Set Finder labels per script

Hi Community,
after a file server migration I lost on each folder all Finder labels. With the lsmac utility I can fetch the label color for each object and with the setlabel utility I can set a label color for objects. Both utilities come with the osxutil suite.
Okay so far so good, the solution is based in this two utilities but how can I combine this two commands in a script which read out the label colors of each folder on the source file server and set the right label color of each folder on the target file server. Both servers are mounted via AFP on a Mac workstation.
The following (test) command reads only a few folders, I would expect that the find command should run recursively but it doesn't:
$ find / -type d -print0 | xargs -0 lsmac -L
Orange ------ 93 items - Applications/
None I----- 37 items - bin/
None I----- 0 items - cores/
FSPathMakeRef(): Error -36 returned when getting file reference from //dev
None ------ 14 items - Developer/
The following command run like the **** but print out mostly garbage:
$ find / -type d -print0 -exec lsmac -L {} ;
Okay, now I've already problems to determine the right label color of each folder. I'm far away from setting a label color. Help would be very appreciated in this job.
Thx & Bye Tom

I do NOT know the syntax of the lsmac nor the setlabel commands, so this is just an untested template.
#!/usr/bin/env bash
find / -type d | while read file
do
color=$(lsmac "$file")
[[ "$color" = None * ]] && continue
[[ "$color" = *: Error* ]] && continue
(set -x
setlabel "${color%% *}" "/Volumes/REMOTEVOLUMENAME/$file"
done

Similar Messages

  • Setting Finder Label for Apple Utilities?

    Just ran into something interesting - I'm messing with some external drives and constantly going into disk utility. So, I thought I would assign a label to it to make it that much easier to find in the list of applications....
    Except you can't! I checked and several Apple utilities sport the same behavior
    I thought it might be a permissions issue, but playing around with permissions hasn't yielded anything, and googling around and searching hasn't turned up anything on this either.
    How annoying! If anyone has any insight, I would greatly appreciate it. Thanks!

    So, I take it there is no way to make "Disk Utility" writeable from the Finder? Because I did play with the permissions.
    Figures. Well, it's not something I feel compelled enough to research how to do it Terminal - it is annoying, though.
    Thanks for your response.

  • Setting Color Labels in a Folder

    Hey guys! I'm kinda new to AppleScript in general, so please bear with me if this is just a simple request here, but basically i've been wanting to change the background of the finder windows to match the grey background of the iTunes grid view. However, since the font colour of the files and folders in Finder can't be changed, but the only way is to place a border around them (grey seems to match best). Now i've found a script that manages to do this for all the files in the folder and its subfolder based on the filetypes outlined in the script. However, none of the folders themselves have changed to the desired grey colour.Its clearly because the file type for the folder hasn't been added, but im not sure how i do that. As you can see I tried adding "Folders" to the "set fileColorList to greys" line, but its a no go... Is there any way i can just change that whole section of code to just have all the files and folders within the subfolder to go grey? (i.e. greys{"*"} or something) rather than having to individually add the filetypes?.
    Here's the code:
    tell application "Finder"
    set processFolder to (choose folder with prompt "Select a folder to change label colors") as item
    my digDeeper(processFolder)
    end tell
    on digDeeper(myFolder)
    tell application "Finder"
    my changeColors(myFolder)
    set subFolders to every folder in folder myFolder
    if (count of items in subFolders) is greater than 0 then
    repeat with thisFolder from 1 to count of items in subFolders
    set processSubFolder to item thisFolder of subFolders as string
    my digDeeper(processSubFolder)
    end repeat
    end if
    end tell
    end digDeeper
    on changeColors(myFolder)
    set fileColorList to {greys:{"Folders", "mpg", "pages", "keynote", "numbers", "mpeg", "bmp", "wma", "c", "cpp", "dmg", "doc", "asf", "jpg", "jpeg", "ram", "h", "hpp", "mpkg", "iso", "bin", "ppt", "pps", "bundle", "mov", "qt", "gif", "aif", "aiff", "htm", "html", "hqx", "tar", "xls", "mp4", "rgb", "rgba", "pcm", "js", "css", "cgi", "pkg", "gz", "z", "tgz", "localized", "pdf", "avi", "tif", "tiff", "mp3", "m", "zip", "eps", "ai", "wmv", "mkv", "m2ts", "mov", "ts", "rar", "png", "wav", "scpt", "tbz", "bz2", "dat", "txt", "prefs", "rm", "ram", "rcproject", "ra", "psd", "pl", "xml", "plist", "sit", "rar", "torrent", "rtf", "rtfd"}}
    tell application "Finder"
    try
    set (label index of every file of item myFolder whose name extension is in greys of fileColorList) to 7
    end try
    end tell
    end changeColors
    Thanks for any help!

    Your folder action script doesn't work because of one simple error:
    set label index of every item of entire contents of processFolder to 7
    Nowhere in your script is 'processFolder' defined, so AppleScript has no idea what you're trying to do.
    Given that you (correctly) iterate through added_items, the correct format would be:
    on adding folder items to this_folder after receiving added_items
      repeat with item_ in added_items
        tell application "Finder"
          set label index of item_ to 7
        end tell
      end repeat
    end adding folder items to
    In other words, this changes the label index of each item just added.
    That should work provided you're dropping files into this folder. If you're dropping folders then this would set the label index of the folder itself, but not necessarily the items within that folder. For that you'd need to add a check to see if item_ was a folder and add code to handle folders.
    Also note that this kind of folder action will only work on the folder itself - that is, if you have folder A that contains subfolder B, then dropping a file into subfolder B won't trigger the script and won't change that item's label. To do that you'd have to attach your folder action to subfolder B.

  • How to find out the script name used in driver program

    Hi Folks ,
                 I want to find out the Scripts(print program) used in my driver pogram .
    How is it possible any Tcode availble for this ?
    Thanks ,
    Jaga.D

    Hi Jagadish,
    Go to transaction SE38 and open the program RSNAST00. There search for the subroutine TNAPR_LESEN.
    Set a break point at that subroutine and leave. When printing the data from a transaction to a script or form (Like VA01 or VL02N), debugger is started when the processing reaches the subroutine in RSNAST00. There double click on the field TNAPR-FONAM. continue step-by-step execution. The field will display the name of the script or form that is currently being used.
    Another way to do this is to go to transaction NACE and check the transaction for which you want to find out the script. There you will find the script and print program that have been set for a particular transaction.

  • Label Graphic Script CS4 Questions?

    Trying to test the label graphic script in cs4. How do I control the font in the label box. Seems to be defaulting to a font I dont want to use. Want to use a simple 9 point font. Is there any further documentation on the use of this script or other cs4 scripts? I have not done much with scrips but think they might be helpful in my workflow.
    Rob

    You need to set up, and select, a paragraph style that you want to use.
    Peter

  • Setting "Omit Label Interval" on 2D Line Flash Chart

    Hi,
    i have a 2D Line Flash Chart showing a few values or many values. (depending on the selected interval, eg. minutes, hours, days, week, months ..)
    Unfortionatly if the flash chart has to show many values, the labels cannot be read (because they are too many)
    In Section "Display Settings" i can set "Omit Label Interval", but i need to set this property dynamically - how can i do this?
    kind regards
    Günther

    Hi Günther,
    I used a similar example a while ago unfortunately for you I started the refresh when I clicked on a button:
    Page header:
    <script language="javascript" type="text/javascript">
    function fnc_UpdateChart ()
      var v_region_id = $v('P1_REGION_ID').substr(1);
      apex_RefreshChart ($v('pFlowStepId'),v_region_id , navigator.language );
    </script>Region footer (from your chart region):
    <script language="JavaScript" type="text/javascript">
    $s("P1_REGION_ID", "#REGION_ID#" );
    </script>I had some trouble with the IE where the update didn't worked? I don't know if you will experience the same.
    You would now need to integrate a timer. I made an example with an IRR: [http://apex-at-work.blogspot.com/2009/08/automatic-refresh-of-interactive.html|http://apex-at-work.blogspot.com/2009/08/automatic-refresh-of-interactive.html]
    It's a beginning. Hope it helps.
    Tobias

  • Set variable samples per chanel from counter

    Hi, all. I have to set variable samples per chanel for sample clock. I want to take that samples from counter input with different number of edges for every second (different speed of metal plate). What can i do for that task? Is there a god example for this problem?
    Thanks.

    Hi, GerdW. Thanks for reply. I want Sample Rate and Samples per Chanel to come from couter. CI is a metal plate with 52 tooth. The speed of metal plate is 500 cycles/min but it is not constant ( may be 490-520). For example rate of cycles is 500/60=8.33 cycles/sec. Rate of edges (tooth) is 8.33*52=433 edges/sec, but when speed goes over or under 500 the rate is different. How to put that variable samples in sample clock on AI?
    P.S. Matlab script is to calculate max samples per chanel for mean function in while loop. In the picture control "Speed cycles/min" is that 500 cycles/min speed. I have to put in that control the variable rate of edges. Other solution is to set 1 sample per edge, but i have problem here to .  

  • Set network time via script or terminal command

    Hi
    We are trying to set our computers to the network time at login.  We tried modifying the MCX time via workgroup manager but that did not work.  I have used my old script/command I used for 10.6 to set our 10.8 machines to the network server but it says command not found.  Been googling to find a command/script that works for 10.8 but so far unsuccessful finding a solution. 
    This is the script/command I used:
    # Set time zone and time server.
    $systemsetup -setusingnetworktime on
    $systemsetup -settimezone America/New_York -setnetworktimeserver time.apple.com
    Any suggestions would be greatly appreciated!
    Cheers

    Why does having the System Preference in Date & Time set  to automatically set the date and time from the Apple servers not work for you?

  • I have a new email address. Changed this on my itunes account. On iPhone deleted old icloud account and created new with new email. I have set find my phone to on. When I download music it no longer goes to icloud an does not show up on my iphone.

    I have a new email address. Changed this on my itunes account. On iPhone deleted old icloud account and created new with new email. I have set find my phone to on. When I download music from itunes it no longer goes to icloud an does not show up on my iphone.

    I have the same problem - it is maddening. I rely on this iPad for work so this is not just an annoyance! The above solutions of changing the appleid on the device or on the website do not work.
    The old email address no longer exists - I haven't used it in a year probably and I no longer have the account.  I logged into the appleid website and there is no trace of the old email address so there is nothing that can be deleted or changed there.  On the iPad there is no trace of the old email address so nothing can be deleted there either. I have updated the iPad software and the same problem comes right back.  Every 2 seconds I am asked to log in using the old non-existent email.  The device is currently useless.
    The only recent change to anything was the addition of an Apple TV device, which was set up using the correct login and password.
    Does anyone have any ideas? The iPad has been backed up to the iCloud so presumably it now won't recognize the current iCloud account? So restoring may notbe an option?

  • How to set page numbers in scripts

    Hi,
        i want page numbers at bottom of page,
      please tell me how to set page numbers in scripts?

    Hi,
    In footer
    use this
    &PAGE& / &SAPSCRIPT-FORMPAGES&
    &PAGE& of &SAPSCRIPT-FORMPAGES&
    reward if it helps..
    regards,
    Omkar.

  • Transaction to find ecatt test script

    transaction to find ecatt test script and the table which stores ecatt test script
    transaction to find function group and the table which stores function group
    transaction to find general text and the table which stores general text
    where i should be able to change the devlopment class

    Hi Avinash,
    For ecatts check development class/package SECATT_DDIC and transaction SECATT.
    For general text transaction is SO10 and tables are STXH and STXL.
    For Object Naviagtor SE80 you can change development class.
    For function groups check ENLFDIR table.
    All transaction codes are stored in TSTC and TSTCT tables
    Thanks
    Lakshman

  • I can't find the MATLAB script node in labview

    We are using a MAC G4 with OS 9. We also have labview 5.1. I have looked under Mathematic>>Fomula in the tools palette and I cannot find the MATLAB script node.
    Is there an extra download that I need to get this MATLAB script node?

    The HIQ and MATLAB script nodes are only available in the full and professional development systems. If you have one of these versions, these nodes should be under the Mathematics>>Formula palette.
    If you have the base package of LabVIEW, you will not have access to these script nodes. Details about which options are included in which development packages can be found at:
    http://www.ni.com/labview/devchart.htm

  • Find Label Missing in Advanced Search For Specific User

    for specifi users FIND label is showing but some of the users in advanced search this find label is missing . top of the applictaion it is there
    plz let me know why this is problem is coming
    find button should visible to all users......................
    give me repaly ASAP

    Hi
    CRM 5.0
    its not related to application,modification ..but my problem is the find label is working for some of the users.but some of the users find label is not there,
    plz let me know where i have to make corrections for this problem........

  • Can I set Finder to open all folders so I can see all files always

    Is there a way to set Finder to open all files when I click on say "Documents" or "Music" or whichever? As it is set I have to click on every plus sign within a folder or folders themselves to see what is inside, and, for example, in Music, it means hundreds of folders where the individual songs reside.
    Thank you.
    Roxy

    Actually, there is a way to do this on a folder by folder basis: for instance, if you have your home folder open and in list view, if you hold down the option key and click on the arrow in front of the Documents folder, it will open, and every single sub-folder and sub-sub-folder will also open. This produces a pretty unwieldy window, and I can never remember the key combo to get them to all close up again (I'm sure there is one.....), but it does work.
    Francine
    PS--It seems simply clicking the arrow to close the Docs folder does sort it out so a normal click produces a non-opened state of the sub-folders.
    Francine
    Schwieder
    Message was edited by: Francine Schwieder

  • Detecting clientside NLS_LANG setting in SQL*Plus script

    Our company has developed an application that uses an Oracle database as it backend. Companies can buy our application and run it against their own Oracle installation.
    A new version of our application often requires an update to the Oracle database schema.
    Together with new application files we send our customers an update.sql script they must run against their database using SQL*Plus.
    This update script may contain international characters like é for example:
    UPDATE SHOPS SET DESCRIPTION = 'Café'
    WHERE SHOP_ID=1We save the SQL-script file in windows-1252 encoding so the character é is encoded as 0xE9 in the script file.
    When the DBA running the upgrade script has set NLS_LANG=.WE8MSWIN1252 this works perfectly.
    When the DBA has set his NLS_LANG=US7ASCII the é gets replaced by an upside-down question mark. Other NLS_LANG settings can also be troublesome.
    To prevent this we give very clear installation instructions. However, nobody reads them. This leads to two questions:
    A) Is there a way to prevent this problem so I do not depend on the NLS_LANG setting by the DBA running the upgrade script?
    B) Otherwise: is there a way to test for the NLS_LANG setting inside the script and abort if it is not WE8MSWIN1252?
    Info:
    Database is 10.2.0.3/10.2.0.4 and sometimes 10.2.0.5, always database character set WE8MSWIN1252.
    Client software: I do not know what each DBA uses but it will be mostly 10g client software
    Client OS: Some DBA's will be running the script from Windows, others from some Unix variety. I cannot control that.

    I agree with Sergiusz. You're much better off if you can remove character set dependencies from your scripts by using commands like this.
    UPDATE SHOPS SET DESCRIPTION =  unistr( 'Caf\00E9' )
    WHERE SHOP_ID=1 ;If that's not possible however you can try this approach to determine the session's character set.
    SQL> column USERENV_LANGUAGE format a30
    SQL> column oracle_charset   format a20
    SQL> r
      1  select
      2    userenv_language
      3  , substr
      4    ( userenv_language
      5    , instr( userenv_language, '.' ) + 1
      6    ) as oracle_charset
      7  from
      8  ( select sys_context( 'USERENV', 'LANGUAGE' ) as userenv_language
      9    from dual
    10* )
    USERENV_LANGUAGE               ORACLE_CHARSET
    AMERICAN_AMERICA.AL32UTF8      AL32UTF8 --
    Joe

Maybe you are looking for

  • Acrobat 9.0 - "attach to email" function no longer works (Win 7, MS Outlook 2010)

    Dear All, All of a sudden, my "attach to email" function no longer works.  If I open a PDF in Acrobat 9.0, and I try to "attach to email," nothing happens.  This feature has always worked for me in the past.  When I check for updates, Acrobat reports

  • I need some help with some of the basic playlists please?!

    Basically, I always enjoyed using the playlists 'recently added' and 'most played' that originally were on my ipod touch but suddenly they have gone off my ipod  but have remained on my itunes! I have tried syncing my ipod many times but nothing has

  • Messages after installing 5.1

    We have 3 iPhones in the house. All 3 are connected to Internet via WiFi. Since I upgraded to iOS5.1, one of the other tywo appears with a blue button in the Messages app, the other with a green... If I send a message to the one that is no longer rec

  • Gethttprequestdata() not returning all header info. with CF10, should it?

    Our Single SignOn agent (SiteMinder) places a custom variable, HTTP_EMPLOYEEID in the header.  Using ASP, I can dump the header info and see that variable/value. But, with a similar CF script, some info, including HTTP_EMPLOYEEID is not there.  Any i

  • Premiere Pro CS5 won't import mov file?

    Mac Mini OSX 10.6.8 2.4GHz Duo Core Intel 8GB RAM: Quicktime 10.0(128) I have serveral MOV files that a Camera Crew shot raw footage then recaptured to MOV for me but now I found out that I can't import these files into Premiere CS5, I get a codec mi