Folder icon command line

Hi,
setting a custom item for a folder is easy with the copy/paste method. But I would like to script it.
As far as I have seen, if a custom icon is set for a folder, inside that folder an Icon file is created and the data (the icon itself) is saved in the "resource fork" (0KB for the file in the terminal, but on a smb-server, the file is split into 2 files and the ._Icon file has some 100KB).
But just copying that Icon file over (from a folder, where it is set to the folder, where I want it to show up) with cp or ditto -rsrc doesn't help. The Icon for the folder doesn't change.
Do you know how to change the folder icon in a script (be it bash or Apple script)?
What would be the commands to set a custom icon for a folder?
thanks, kind regards, Herlind

Hello Herlind,
I think you need not only to copy the 'Icon\r' file to the destination folder but also to set the custom icon flag of destination folder.
Try something like this. It uses SetFile command of Developer Tools.
--SCRIPT (not tested)
set src to POSIX path of (choose folder with prompt "Choose source folder.")
set dst to POSIX path of (choose folder with prompt "Choose target folder.")
copyCustomIcon(src, dst)
on copyCustomIcon(src, dst)
string src, dst : POSIX path of source and destination folders
set srcicon_ to quoted form of (src & "Icon" & return)
set dst_ to quoted form of dst
set sh1 to "ditto --rsrc --extattr " & srcicon_ & " " & dst_ -- copy icon file to dst
set sh2 to "/Developer/Tools/SetFile -a C " & dst_ -- set custom icon flag of dst
do shell script (sh1 & " && " & sh2)
end copyCustomIcon
--END OF SCRIPT
cf.
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/SetFile. 1.html
Hope this may help,
H

Similar Messages

  • Open file in folder with command line program

    I have a file, which is in native format for a given program [1] I have installed. This program I can start from Terminal.app and within the program I can open the file. The question is if I can have associated with this specific filetype this program and when I double click on a file of this type I can have a Terminal.app opened with my program running inside opening the file for me.
    Btw, on a regular Linux/Unix I would just associate this filetype with the path to my program. On Mac I can associate only with .app.. Is there other way?
    [1] http://root.cern.ch/drupal/

    I do not fully understand your question.
    You need to make your program into an application. I have not programmed on Mac OS so I to not know the details. You could hack some existing app. I do know that the plist file for an app points to the starting program.
    Another work around would be to write an apple script file to call your program.
    This applescript invokes a unix program.
       Run in the Script Editor.
       Click on the Event Log tab to see the output from the log statement
       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) & " --- "
       -- ask the user for the folder name.
       -- quoted form of (POSIX path of (choose folder))
       set theFolder to "/Applications/Utilities/Disk Utility.app"
       set theFolder to quoted form of theFolder
       log "quoted form is " & theFolder
       -- running two Unix commands. Separate with a semicolon 
       set fromUnix to do shell script "cd " & theFolder & "; ls -ld ."
       log fromUnix
       display dialog fromUnix giving up after 30
    end run
    This applescript program received a file dropped on it.
    There is a lot of extra stuff but look at on open dropped_items This line gets a list of files dropped on the applescript. Your have to change the name format.
    on open dropped_items
       -- Remember you need to turn on enable assistive devices
       -- this lets applications software to access screen elements
       -- blue apple > system perferences > universal access > enable assistive devices
       -- Write a message into the event log.
       log "  --- Starting on " & ((current date) as string) & " --- "
       -- set see to alias "Macintosh-HD:Users:mac:Desktop:app.html"
       -- set dropped_items to {see}
       set the_app to "Safari"
       repeat with dropped_item_ref in dropped_items
          --set UrlBase to "xzzx FILE://" & POSIX path of dropped_item_ref
          --display dialog UrlBase
          -- Activate
          activate application the_app
          -- Open the URL 
          tell application the_app
             open dropped_item_ref
             -- print dropped_item_ref
             tell application "System Events"
                tell process the_app
                   delay 3
                   -- click menu item "Print..." of menu "File" of menu bar 1
                   keystroke "p" using command down
                   delay 1
                   keystroke return
                   delay 10
                   keystroke "w" using command down
                end tell
             end tell
             --quit
          end tell
       end repeat
    end open

  • How to merge multiple documents via command line (Adobe Acrobat Pro 9.3.2)?

    I'm searching solutions to merge multiple documents (all stored in one folder) via command line or batch file to a single PDF-File...
    Is there a way to do this?
    Finaly I want to control this from a application written in MS-Access. So, perhaps there are some features already integrated in Access to do this?
    Thanks for answer!

    If you have some programming experience you could probably do this using VBA from within MS Access to control Acrobat via OLE.
    Lots of examples on the Web.
    Hope this helps

  • Can I add a New Folder to existing Business Area with Command Line?

    Hi,
    Can I add a New Folder to existing Business Area with Command Line in Discoverer (java or executable)? I am trying to do this with /load...
    /connect walkep_apps/walkep@smpdev1
    /load Visualizations /eul walkep_apps /user smp_naps_apps /object VISUAL_20K /capitalize /remove_prefix /insert_blanks
    /aggregate DETAIL /show_progress
    ... but this creates a new business area, "Visualizations 1", which is not what we want! We want to add the VISUAL_20K to the existing "Visualizations" business area. Many thanks in advance.
    Phil

    Bang on. thanks
    three's always an obvious solution.
    I'll post another question about how to attached a file into a Mail message which is automatically compressed/zipped. Or do i have to find the file in Finder, compress it and then attached it?

  • How to configure Team explorer 2010 command-line tool in Mac x os. configure shell or system path to include the folder to which (TF client) unzipped archive available.

    How to configure Team explorer 2010 command-line tool in Mac x os.
    Hot to configure shell or system path to include the folder to which (TF client) unzipped archive available. I am new to Mac X OS. Please help.

    Dmitry,
    Thanks for the great writeup!
    I think I've got my universal instant client libraries built correctly.
    I too am using MacBook Pro but I'm getting stuck at building the 32 bit oci8.so
    First problem is my pecl download (ver 1.4.1) did not contain a "configure" file so ./configure failed.
    I used configure from /sw/....... to try to continue.
    Second problem. Using existing configure from /sw/.... I used an appropriate variation of your example command
    (./configure --with-oci8=instantclient,/usr/local/oracle/instantclient_10_2 && make).
    Things look like everything ran OK but The output does NOT include an oci8.so file
    So I guess my question is: Which "configure" should I be using? And if it is not the one on the system under /sw/...
    where would I get it since it doesn't come in the pecl download?

  • Folder created in Windows Explorer not visible in Command Line as SYSTEM user

    Hello everyone,
    We have an odd behavior with an application installation, which I cannot make much sense of.
    We are trying to deploy an application on Windows 8.1 Enterprise x64 which tries to access
    C:\windows\system32\config\systemprofile\Desktop during installation.
    This folder does not exist by default in a Windows 8.1 installation. Hence we am creating this folder using a VBS script manually. The VBS script also launches the application EXE. The setup itself runs under the SYSTEM account (in order to be deployed using
    SCCM).
    When the install script is launched, we can see in the Windows Explorer that the "Desktop" folder is created in the systemprofile directory. However, to the setup running under the system account, this folder is not visible.
    I have verified this by running a command line prompt under the SYSTEM user and navigating to
    C:\windows\system32\config\systemprofile\. Using the "dir" command does not show you a "Desktop" folder under the EXACT same path.
    When we create the Desktop folder from this command prompt, the application installs just fine.
    What are we missing? Any inputs are highly appreciated.

    Hi,
    Might this need to quit the command prompt after the folder creation, then reload it to continue the installation of the software?
    Best regards
    Michael Shao
    TechNet Community Support

  • Command line desktop icon

    I have finished my application in forms10g,
    as I create an icon in desktop for the execution?,
    What command line I can use?
    thank you very much

    Hello,
    For instance this one:
    "C:\Program Files\Mozilla Firefox\firefox.exe" http://your-machine:8889/forms/frmservlet?config=your_config
    Francois

  • Can I create a new folder using the command line interface

    Hi.
    Is there a way to create a new folder in an existing business area, from the command-line?
    We have an application that provides an interface for the user to create a table and load flat file data into the table. After loading the data, the user will verify the loaded data using discoverer. If there is a command line interface to create a new folder, then the script that created the table can also call the discoverer command line to create a new folder for the new table. Is this possible?
    Thanks

    Hi,
    I think I am having a similar question here. I am using Oracle 10g on Windows xp.
    I logged in to Oracle from command prompt. I used command “create directory myFunDir as 'd:/funDir';”. Oracle returns: “Directory created”. But I couldn’t find the directory “myFunDir”! Where is it?
    Thanks.
    Newbie.

  • [plasma] Add icon of "command line" on desktop [Solved]

    Hi,
    for my work i use a ssh redirect port to make some applications (rdp, samba...) works and like this i can work outside like if i were inside the factory. So on kde4 i could put an icon with the command line, directly on the desktop.
    I guess it is possible to do the same on kde5. For simple application on kde5 i drag on the screen but it is not possible to see inside it and to change the code that is use.
    Is ther a way to do that on kde5 (plasma).
    Thanks
    Sincerely
    Last edited by archqt (2015-05-04 11:47:16)

    damjan wrote:Right click the "K" menu - the one that opens kickoff - and choose the "Edit applications…" menu.
    Then add you app, remember to check the "run in terminal" option.
    Thanks but is there any way to only have icon on desktop and not a line on the menu ? I can see the 2 are connected.
    Thanks

  • How to create Bin Release folder of my Application through command line

    Hi friends
                   Can any body guides me how to release my flex project without using flash builder.i mean i want to create bin release folder only from dos using SDK.
    is this possible?Waiting for reply.
    Thanks And Regards
      Vineet Osho

    Hi Vineet,
    To do what you are asking, I think you will want to use Ant from the command line (DOS).  Rather than go over the details of how to do that here, the Adobe Live Docs seems pretty thorough: http://livedocs.adobe.com/flex/3/html/help.html?content=anttasks_1.html
    -Mike

  • Keeping a jpg folder in sync (automatic export or lightroom command line feature)

    Working with raw is good, but, sometimes, you need to have your "starred" photos in jpg somewhere for various reasons (for example you want to sync that jpg folder with a web portfolio or you want a folder to browse your photos without opening LR).
    What would be good is to be able to sync certain raws with jpg, i mean, a scheduled (windows) job which, at, say, 11am, checks modified raws (both raw and XMP), launches LR in background and export them all to that folder using a predefined profile.
    This would very useful to keep an online gallery without doing manual work everytime a pic is choosed (by starring or flaggin it).
    Currently SDK allows scripting inside LR, it would be great to be able script LR itself in some way (i mean a command line version, like "lightroom.exe /export profilename file.raw" which exports that file to jpg with lighroom edits, or lightroom.exe /select "flag=red" /export profilename). This would be really really useful. If we combine this with export SDK it could also be able to upload photos by itself once exported.

    I agree. I have just recently looked into how I can semi-automate this, but the problem is that as far as I can see, there is no way to export files using the same folder structure as they have inside LR, so it is difficult to compare the exported files with what is inside LR. For example, if the raw file is in c:\images\\folder1\image1.raw I would like to export it to f:\imagecopies\folder1.image1.jpb without having to give the "folder1" name (i.e. the root "f:\imagecopies" should have been enough).
    Maybe this can be solved with a export plugin, but I haven't looked at the SDK yet.
    H

  • Can i print a file using thunderbird with command line switch

    Trying to automate printing task. I have a folder with 1000's and 1000's of eml files that need to be printed using thunderbird.
    I am able to get the command line switch to open the file in thunderbird.
    But what i really want is to print these files directly using thunderbird without opening the file in GUI.
    Thanks
    Dennison

    ส่งจาก จดหมายของ Windows
    จาก: Pat Willener
    ส่งเมื่อ: จ. 5 มกราคม 2558 6:15
    ถึง: thang dinhvan
    How can I print a file with mixed page orientation in windows 8.1?
    reply from Pat Willener in Adobe Reader Touch for Windows 8 - View the full discussion 
    I have a win 7 and a win 8.1 computer.  I have a file which contains both landscape and portrait pages.  The file prints correctly with the mixed orientation from the win 7 pc, but will only print with either landscape or portrait on the win 8.1 pc. 
    I am using Adobe reader XI on the win 7 pc and adobe touch on the win 8.1 pc
    If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/7064031#7064031 and clicking ‘Correct’ below the answer
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/7064031#7064031
    To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, & "Stop Following"
    Start a new discussion in Adobe Reader Touch for Windows 8 by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624.

  • Download Folder Icon

    Recently, the icon, fan, grid, or any view setting for checking my download folder on the dock has stopped updating any changes made to it. If I delete a file from the Downloads folder, the icon or any view on the dock will still show the file listed as if it had not been deleted.

    Not a problem.
    1. Folder creation
    Open your user home folder in Finder and from the 'File' menu, select 'New Folder', and name it 'Downloads'. Press return for it to register.
    2. Folder icon restoration
    Now, with Finder as the active application, click on the 'Go' menu and select the 'Go to Folder...' menu item. In the window which appears, copy and paste the following line (no line breaks) and hit return.
          /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/
    In the location which appears, double click on the file named DownloadsFolder.icns, which will open it in Preview. In Preview, type cmd+c to copy the image. Now, go back to your home folder and highlight the 'Downloads' folder which you created. Type cmd+i to bring up the info panel. Click once on the generic folder icon near the top of the panel to highlight it. Now type cmd+v to paste the copied image. It should now look like the original Downloads folder.
    3. Setting proper permissions
    Open a Terminal window (/Applications/Utilities/) and enter the following sequence of command lines..
          cd ~
          chmod go-rx Downloads
          exit
    .. and then quit Terminal.
    Concluding remarks
    And you're done. I'm not entirely sure if the recreated folder will function without issues. But as far as I can tell, for all intents and purposes, it shouldn't be any different from the original folder.
    Yang

  • Help packaging an android apk through command line

    Hello everyone.  I've recently developed an app that is near the release deadline and I've ran into the problem of low resolutions icons.  All of the troubleshooting I've done has claimed I'll need to manually package the app through the command line to do this.  I have never done this before so I'm having some trouble. 
    I've downloaded all of the required files I believe and have reached the correct bin folder, I'm completely clueless as to what syntax I need to type in from this point though.  I've gotten as far as "adt -package" which then outputs that I'm missing additional information, but as I said, I haven't used command promt much and I have no idea how to format the rest of the information I need to put in or how to attach my current app.xml file to it.
    Any help would be appreciated.
    Edit: Nevermind everyone.  After a lot  more time spent researching I've managed to piece together how to do it and actually understand it as well.

    Hi,
    Here is the command to package android apk through command line;
    <adt-path> -package -target <target-option e.g. apk, apk-debug etc> -storetype pkcs12 -keystore <your certificate> -storepass <password> name.apk app.xml name.swf assets
    Please run adt -help on terminal or cmd if you need any help regarding targets or packaging command. adt is available at you sdk/bin/adt folder.
    Also, you can see the page http://help.adobe.com/en_US/air/build/WS901d38e593cd1bac1e63e3d128cdca935b-8000.html for more details.
    Hope this will help.
    Regards,
    Nimit

  • Hello I am on a macbook pro (retina IOS 9) i have installed xcodes and command line tools but codeblocks does not compile, terminal gives this message /Users/MacPc/Desktop/Untitled1: Permission denied      any one has a solution

    Hello I am on a macbook pro (retina IOS 9) i have installed xcodes and command line tools but codeblocks does not compile, terminal gives this message /Users/MacPc/Desktop/Untitled1: Permission denied      any one has a solution?? please...

    Back up all data before proceeding.
    This procedure will unlock all your user files (not system files) and reset their ownership, permissions, and access controls to the default. If you've intentionally set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it, but you do need to follow the instructions below.
    Step 1
    If you have more than one user, and the one in question is not an administrator, then go to Step 2.
    Triple-click anywhere in the following line on this page to select it:
    sudo find ~ $TMPDIR.. -exec chflags -h nouchg,nouappnd,noschg,nosappnd {} + -exec chown -h $UID {} + -exec chmod +rw {} + -exec chmod -h -N {} + -type d -exec chmod -h +x {} + 2>&-
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window by pressing command-V. I've tested these instructions only with the Safari web browser. If you use another browser, you may have to press the return key after pasting.
    You'll be prompted for your login password, which won't be displayed when you type it. Type carefully and then press return. You may get a one-time warning to be careful. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command may take several minutes to run, depending on how many files you have. Wait for a new line ending in a dollar sign ($) to appear, then quit Terminal.
    Step 2 (optional)
    Take this step only if you have trouble with Step 1, if you prefer not to take it, or if it doesn't solve the problem.
    Start up in Recovery mode. When the OS X Utilities screen appears, select
              Utilities ▹ Terminal
    from the menu bar. A Terminal window will open. In that window, type this:
    res
    Press the tab key. The partial command you typed will automatically be completed to this:
    resetpassword
    Press return. A Reset Password window will open. You’re not going to reset a password.
    Select your startup volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
               ▹ Restart
    from the menu bar.

Maybe you are looking for

  • How to connect a 2009 Cinema Display with mini DisplayPort to modern card

    Hello: I am ready to install a new NVidia Quadro K5000 for Mac in my not so old Mac Pro 4,1 (2009). I already installed Mountain Lion (10.8.3) as required. The problem is that the Mac Pro came with a Led Cinema Display which apparently only can be co

  • Email - Spool List

    Hi Experts - We have a report scheduled in the bacground. The spool file generated will be automatically emailed to a group using the standard PDF via Email output functionality(instead of sending it to a physical printer). It works fine, the PDF att

  • Screen - exits - step by step simple examples

    hi , i am new to user exits. pls help me by giving step by step example for creating a subscreen with 2 fields , and incorporate with some standard sap transactions. there are many who discussed the same topic in the forum ,but i find confusing. *so

  • SRM Org structure clean-up / deletion

    We have developed a process to clean-up our org structure of people who have left the company.   In testing, we found that the standard deletion process does not allow for deletion of users who are tied to a shopping cart.    Our business requirement

  • Can we change the download directory update? (documents and settings)

    Hi I want to update my Ipad2 and I have downloaded the update with Iunes in "documents and settings" directory but my disk is full and I can't installe it. Can we change the path od the download directory??? THX