Watching for changes to the filesystem?

Hi,
Is there an automator object that will allow me (through Applescript perhaps) to receive notifications of when something in a certain part of the filesystem changes?
For example, I would like to be notified when a new document is added to the Documents directory (likewise I'd like to be notified when a document is removed from that directory).
Thanks,
BT

Hi BT
AppleScript has a mechanism called Folder Actions, which will do exactly what you require. Automator workflows can also be saved as Folder Actions, but they run more slowly for reasons I'll explain later.
A Folder Action script runs when you make a change to a folder to which the script has previously been attached. The possible changes are: opening the folder window, closing the folder window, moving the folder window, adding items to the folder and removing items from the folder. The last two are what you're looking for.
Only these five changes will trigger a folder action; folder actions don't run if you edit or update a file within a folder.
Folder actions aren't recursive: if you add items to a sub-folder of the folder to which the action is attached, the action attached to the parent folder won't run.
Here's an AppleScript that will do what you want, with the notification in the form of a dialog.
--begin script
on adding folder items to this_folder after receiving these_items
set folder_name to name of (info for this_folder)
set item_count to (count these_items) as string
display dialog item_count & " Items were added to " & folder_name & "!" with icon note buttons {"OK"} default button 1
end adding folder items to
on removing folder items from this_folder after losing these_items
set folder_name to name of (info for this_folder)
set item_count to (count these_items) as string
display dialog item_count & " items were removed from " & folder_name & "!" with icon caution buttons {"OK"} default button 1
end removing folder items from
-- end script
Copy and paste this script into a new Script Editor document, and save the script into the folder ~/Library/Scripts/Scripting Additions/ (create it if it doesn't already exist).
Control-click on the folder you want to run the action, and choose Enable Folder Actions if they aren't already enabled. Control-click on the folder again, and choose Attach a Folder Action... Navigate to the folder where you saved your script, and choose the script. Drag items in and out of the folder and see what happens.
The dialog can be replaced by any AppleScript commands you like: the script could send an email, log the change to a text file, create a new document in a scriptable application, log the user out, play their top-rated iTunes tracks...
Hope that gets you started. Using Automator would be slower because folder actions created in Automator simply launch a separate Automator workflow application, which then runs the commands which I've scripted directly. This just puts another application in the way of getting the job done.
Why not post in the AppleScript forum if you want to know more?
Cheers,
H

Similar Messages

  • How to realtime monitor changes in the filesystem?

    Does anyone know of a way to realtime monitor for changes in the (windows) filesystem using Java. (file creation in particular). I've done this in VB and C++ using "findfirstchangenotification" which I think is part of the windows API.
    I'm attempting the switch to Java, so I'm rewriting an app that requires this capability.
    Thanks.

    You have to write a class that uses JNI to interface with the OSes underlying API. Since every OS is different Java doesn't have this feature built into the File (or related) class.
    If you've done it before with C++, then all you have to do is probably just copy and paste some code into a java JNI header file. It will generate all the stub code for you all you have to do is fill in the details.

  • How do I listen for change in the global position of a Node

    Hi there,
    I want to create a Wire/Connection node between two scene nodes. I want this Wire node to be updated when one of the nodes is moving. In the common scenario I would listen for change events in the target nodes position and update the Wire :
    targetNode1.translateXProperty().addListener(new ChangeListener<Number>() {
    public void changed(ObservableValue value, Number oldValue, Number newValue) {             
    wire.setStartX(targetNode1.getTranslateX());
    wire.setStartX(targetNode1.getTranslateY());
    wire.setEndX(targetNode2.getTranslateX());
    wire.setEndY(targetNode2.getTranslateY());
    The problem is that the target nodes are children of another container nodes(that are actually moving). So listening for change events in the translate properties of the target nodes does not work(their parent nodes are actually moving)
    Is there way to listent for change in the global position of the target nodes relative to the Scene?

    It sounds very similar to a problem I posted about earlier...
    How to implement a UI similar to a UML Diagram with connections?
    I ended up making my own special bounds property, that updates when the parent's special bounds property changes.
    I also had to listen to the parentProperty change event to add/remove my listener on the parent node.
    All in all, a pain in the butt. There should be an easier way.
    The shortcoming of the solution is that all the nodes in the hierarchy must have my special bounds property implemented (ie. they're all classes under my codebase such that I can implement it), which for the moment is true... I'd like a cleaner solution however.

  • Lock Role for Changes till the transport is released

    Issue : since roles are managed by multiple security administrators, changes are moving against the sequence.
    We have multiple security administrators, is there a way to lock a role for changes until the task/ req is released.
    Example Scenario :
    Security admin 1 : if there is a change request to add SU01 to the role: Z_TESTROLE, Security admin adds it and creates a Change request but does not release it.
    Security Admin 2 : the security admin 2 will get a Change req for the same role Z_TESTROLE to add a tcode PFCG to it. Security admin 2 does his job and moves his transport now even though the first transport does not move the change made by the first security admin moves with the transport for the second admin.
    We have multiple security administrators, is there a way to lock a role for changes until the task/ req is released.

    Hi all,
    Thanks for your responses.we follow a change procedure but I guess its just needs to be refined. Everybody figured out that this is a coordination issue but I was asked to research on any technical ability to handle this.
    Here is a brief overview of our process :
    1) BPO approves the change
    2) Role owner support manager approves the change
    then the Change request comes to 3)Security Manager for her approval.
    I feel from Sox prespective the 3rd approval in not manadatory.
    I'm I correct ??? where can I find Sox guide for SAP ?
    Recap of the incident:
    1)A change ticket is created for the t-code creation and a task is created for the role in which this report is to be added.
    State I role Z_TESTROLE  is with ZMMR0025
    After adding the new report ZMMR0055 the old report ZMMR0025 is removed.
    State II
    The role Z_TESTROLE has tcode ZMMR0055
    now this is tested in development system by the requestor.
    Before this goes into PRD via QA a newsflash is sent to all the endusers (so that they know which t-code to use)
    Meanwhile if another security administrator works (suppose adds a new tcode or changes an authorization)  on this while the role is in state II changes made by Admin 1 are transported along with the second change.
    State II + new changes = State III
    When the role reaches PRD in state III result is the end user losses access to the required functionality ZMMR0025 before ZMMR0055 is made available.
    I hope I’m clear , please let me know if I need to be more specific on any part.
    I appreciate your help.
    regards,
    Salman.

  • Are there any free APPS that allow for chang/embellish  the folder icon

    tired of blue folders.
    there must be some kind of app that can change its appearance or change color or whatever.
    can one change the text font of indiv folders?
    wouldnt one expect this from OS X4.6
    im shocked it has to be the same old blue folder

    Hi, Glenn.
    You can assign any icon you want to a file or folder: see "Mac OS X 10.4 Help: Changing the icon of a file or folder.”.
    You can find nice sets of icons (what you need for step 1) at sites like Icon Factory or ResExcellence.
    Some folks really like the inexpensive shareware application FolderBrander for customizing folders. There's a free trial period and it seems very reasonably priced for what it does.
    The freeware application TinkerTool will allow you to change some of the default fonts used in Tiger.
    When looking for new applications, I recommend searching MacUpdate or Version Tracker. The user-submitted reviews accompanying the listings can be helpful in sorting the wheat from the chaff.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X

  • Log for changes in the SAP table

    Hello All,
    I have a SAP table in which we want to log all the changes being made by the number of users like modifying some record or adding a new record.
    Now What I have done is in the SE11 under technical settings I have checked the checkbox which is "Log data changes", Needless to say I have the developer access key to the system.
    Now I want to test whether changes being made by me in the SAP table are logged somewhere or not I want to know where can we see the changes being logged made by me.
    Is there a tcode to see the changes being made in the table or a SAP table exists for this.
    Thanks,
    Mark

    Hi,
    BAL_OBJECT_SELECT --> To get the LOG for a object
    You can use below Tables/Structures
    DDPRT -->  Structure of ABAP/4 Dictionary logs
    DDPRTXT
    Regards
    Sudheer

  • Uploading .ldt file for changes on the

    Hello all,
    I'm trying to make a change in a Time Sheet, the change I'm trying to make is really simple at the moment (making a field bigger).
    But there where already changes made in the sheet and they need to be kept in tact (added a lov).
    I'm using the next paper as reference.
    Oracle Time and Labor - Configuring The Oracle Time and Labor Timecard User Interface - White Paper
    Normally U need to get the Original template from the location: $HXC_TOP/patch/115/import/US,
    When there are already changes made u need to get the latest version of the template(?)
    The file I needed for time sheet was hxczzhxclayt0019.ldt
    When I upload the original template the LOV who was made in a earlier time did not work.
    This confirmed that tanking the original template was not the way to go.
    I think I need to have the template witch has all the earlier made changes.
    While U upload the .ldt file with FNDLOAD downloading the template is not working for me.
    Even a full download without any parameters does not get the effect I like to see.
    "FNDLOAD apps/pass@DBname O Y DOWNLOAD $HXC_TOP/patch/115/import/hxclaytlayoutsld.lct"
    Does anyone have any advise / idea's on how I can solve this, except building the file from the ground?
    Greetings niels
    Edited by: user12842768 on 10-jun-2011 7:29

    Adding the error message:
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (select project_number projectnumber, project_name, project_id projectid, start_date, completion_date, carrying_out_organization_id, period
    from xx_pa_online_projects_v where period = trunc(FND_DATE.CANONICAL_TO_DATE(:1))) QRSLT ORDER BY projectnumber
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:891)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1145)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1408)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2680)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1683)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:509)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:430)
         at oa_html._OA._jspService(_OA.java:84)
         at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
         at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417)
         at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267)
         at oracle.jsp.JspServlet.internalService(JspServlet.java:186)
         at oracle.jsp.JspServlet.service(JspServlet.java:156)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
         at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456)
         at org.apache.jserv.JServConnection.run(JServConnection.java:294)
         at java.lang.Thread.run(Thread.java:534)
    ## Detail 0 ##
    java.sql.SQLException: Missing IN or OUT parameter at index:: 1

  • Need to monitor any file change in the system, in real time

    Hi,
    I am running a program that I suspect may be doing changes in the filesystem, but I do not know which ones. I would like to know if there is a daemon/program that could help me monitor those changes. I tried AIDE, however, it works by creating a database of checksums for each file and does not report in real time potential changes. I would rather use a program that logs changes and timestamp them. Furthermore, AIDE is not useable with /var files, since there are many of them and they change so often. Is there another good solution?
    Alternatively I would like to run the program with monitoring. For instance, run the process as:
    monitor_program my_program_to_monitor logfile
    This would dump in logfile what my_program_to_monitor does to the filesystem.
    Thanks in advance.
    Last edited by zebulon (2011-08-24 15:44:10)

    no, at least with inotifywait, it is not possible. once you know what file is being changed you can use "lsof" to see what process have opened that file.
    i tried the following to search lsof output first thing when inotifywait finds a file change.
    file=$(inotifywait -r /home/mang/watch --format %w | sed 's/.$//'); lsof | grep $file
    while in another terminal running "vi /home/mang/watch/test"
    the output is:
    zsh 12574 mang cwd DIR 254,11 4096 4723089 /home/mang/watch
    vi 16790 mang cwd DIR 254,11 4096 4723089 /home/mang/watch
    try it!

  • Accessing the filesystem

    Is it possible to acces the real filesystem (not a vfs) through libc with abode air? Even if this do not work for a release build that would be nice. I am trying to setup a dev environement with Lua, but each time I change my assets I have to compile a vfs and my as3 project. It would be really nice to be able to add assets without compiling each time, since as3 compilation (when linking with a flascc swc) is a bit long.
    Also, at the moment I am loading my lua files with an URLLoader, but then I need to execute the file as a string (doString in lua), but a lua doString is a bit harder to debug than a real file. So I'd prefer to do it with a doFile call (which need to do it through libc).

    We do provide a VFS based on URLLoader; you can see an example in the filesystem sample (samples/07_FileSystem). While I haven't tried it, I believe that Air will alow you to access local files via URLLoader. That said, the current implementation of the URLLoader VFS does some processing on the files that would need to be performed each time they change, so it may not speed up your development cycle much. If that's the case, you could try writing a custom VFS by implementing the IBackingStore interface. Note that the VFS system assumes that once your program is running, all changes to the filesystem are performed either via libc or the VFS ActionScript interface. In other words, if you make any changes to the files on your native filesystem, you'll need to relaunch your SWF or Air program before you'll see the changes.

  • Disk order changes, grub problem, filesystem check failed

    I'm having some problems installing Archlinux onto a machine with a lot of SATA drives, some connected by SATA cards. I have tried the 2009-08 netinstaller burned to CD, both -x86_64.iso and -x86_64-isolinux.iso, and I have the same problem with both.
    I am installing from a USB-connect optical drive to an Intel X25-M 80GB SSD connected to a motherboard SATA port. I also have 2 HDDs connected to motherboard SATA ports, and 4 more HDDs connected to 4 SIL-based PCIe SATA cards. Additionally, I have a 4GB Patriot USB flash drive connected to a motherboard USB port. None of the HDDs have a bootable MBR, I am planning to create an mdadm RAID with the HDDs, but the USB flash drive is bootable. The motherboard is an Asus Z8PE-D18 with the latest BIOS, in AHCI mode.
    First thing to note is that I was able to successfully install Fedora 12 linux to this machine in the exact configuration that I am trying to install Archlinux. I just installed Fedora 12 again last night, and it installed and loaded fine when I rebooted from the SSD.
    So, the problems I am having with Archlinux. During install, I found that the SSD is showing up as either /dev/sde or /dev/sdf. This is odd since it was /dev/sda with Fedora. It makes sense for it to be /dev/sda, since it is on the first motherboard SATA port. But I proceeded with the Archlinux install, and grub seemed to detect the stage1 location properly -- root was set to (hda4,0) or (hda5,0) depending on whether the SSD was at sde or sdf. The kernel root was configured by UUID, so that does not depend on the drive order. Okay so far.
    The problem shows up on reboot. The bootloader immediately complains that there is no such partition sde1 or sdf1. I drop into a grub command line and do
    find /boot/grub/stage1
    and it replies with (hd0,0), so I modify the boot line to root (hd0,0) and boot. Now it gets pretty far. Lots of boot messages scroll by. Here are some of the last few before the problem:
    Waiting 10 seconds for device /dev/disk/by-uuid/22a35aa2-9799-4575-b1eb-456e819a1a26 ...
    kjournald starting.  Commit interval 5 seconds
    EXT3-fs (sde1): mounted filesystem with writeback data mode
    INIT: version 2.86 booting
    ::Starting UDev DAemon
    ::Triggering UDev uevents
    ::Loading Modules
    ::Waiting for UDev uevents to be processed
    ::Bringing up loopback interface
    ::Mounting Root Read-only
    ::Checking Filesystems
    /dev/sdf1:
    The superblock could not be read or does not describe a correct ext2
    filesystem. If the device is valid and it really contains an ext2
    filesystem (and not swap or ufs or something else), then the superblock
    is corrupt, and you might try running e2fsck with an alternate superblock
    **** FILESYSTEM CHECK FAILED
    * Please repair manually and reboot. Note that the root file system
    * is currently mounted read-only....
    Give root password for maintenance
    So I logged in as root and did an fdisk -l. The boot SSD was at /dev/sde. The menu.lst has root as (hd5,0), which would be sdf (which was correct during installation, but the disk order apparently changed). The kernel root= in menu.lst used by-uuid, and it at least points to the correct drive, which I suppose is why I was able to boot as far as I did, but when it tries to mount the root filesystem, it fails as shown above.
    So, at initial grub boot, the grub stage1 is found at (hd0,0). During installation, the SSD was sdf, but after booting the kernel, the SSD is sde. What is going on?
    One other experiment  is that I pulled all the drives (including USB flash drive) except the SSD. The HDDs are in hot-swap slots, so that was easy. The PCIe SATA cards are still plugged into the PCIe slots. Then I was able to successfully install and boot Archlinux. But when I plugged the drives back in and rebooted, I had the same problem as detailed above.
    Any suggestions on how to fix this?

    I had the same problem.
    Last week I installed Arch onto a new SATA HD. I wanted to make sure the installation worked before I attached the other drives. On booting with the other drives attached, similar messages.
    My solution:
    Login as root.
    Follow the instruction to mount / as read-write so you can make changes to the filesystem.
    edit /etc/fstab and eliminate the references to /dev/sdxx and replace them with UUIDs or labels (as suggested above) as these won't change.
    in /etc/fstab ...
    # external data sources
    #data /dev/sdb6
    UUID=931d7107-1241-4d82-ad28-fcbe7af8ba69 /data ext3 defaults 0 0
    #Documents /dev/sda9
    /dev/disk/by-label/Documents /data/Documents ext3 defaults 0 0
    Reboot and you should be good.
    You can find the UUID of the drives by using
    $ blkid
    or you can set a drive label with e2label, assuming you are using ext2,3 or 4
    Good luck.

  • How do I listen for changes in a container's components?

    I have a JScrollPane that contains a JTextPane. I want any Container that can possibly contain my JScrollPane to be able to listen for changes in the JTextPane's Document.
    For example, at the moment I'm using a JTabbedPane to hold a number of my JScrollPanes and I want to alter the tab title when any associated JScrollPane-JTextPane-Document is updated.
    Any suggestions on how best to handle this?

    I would use a controller object that manages all your gui components (tabs, scrolls, documents, text panes). Your controller object can register as a listener to the appropriate component, and when it changes, update the title of a tab (or do whatever else) as appropriate.
    Never put business logic like this stuff inside the actual gui components. Create, layout, etc. all the gui components (and related components like Document) from another controller like object instead. It makes handling the various listener stuff like this much easier. Read up on MVC (model view controller) stuff for more info.
    As for the actual mechanics, you could get the document that is used in the JTextPane and register as a DocumentListener. As a document listener, you get notified of all changes that are made to that document.

  • BAdI or USEREXIT for changing data of purchase order header - ME21N

    hello all,
    I would like to ask you any way to change the field "reason for change" of the Purchase Order  header.
    I tried implementing the method PROCESS_HEADER of IF_EX_ME_PROCESS_PO_CUST
    or changing reason_code of structure ekko in user exits EXIT_SAPMM06E_006 and EXIT_SAPMM06E_006
    but it seems not to work.
    How can i do?..
    sap. v. ecc 6.0

    >
    Shiva Kumar wrote:
    > Use the user exit : EXIT_SAPMM06E_012: This is triggered on saving of a PO...and user can add validations etc in the exit...
    > Cheers
    It doesn't work...
    >
    Martin Voros wrote:
    > you get reference to object IM_HEADER in method PROCESS_HEADER of BADI ME_PROCESS_PO_CUST. On this object you can call two methods - GET_DATA and SET_DATA. GET_DATA returns structure with type MEPOHEADER. You can change your field here and then call method SET_DATA with your modified structure. This should work.
    > Cheers
    ..same thing for this solution...
    the field that i want to change is RSCOD inside structure EREVGRID...it seems to have also get_data and set_data methods ( IF_REVISION_ITEM_DCM ),
    but I don't know which BAdI to implement that has a object type ref to EREVGRID...
    Edited by: E_M on May 13, 2008 11:08 AM

  • Avoiding Rebuild of RPD for Change in Physical Layer Data Source.

    Hi,
    I would like to know whether change in physical layer data source will require rebuild of RPD or not.
    Previously our client was using excel spread sheet as source of OBIEE 11g RPD for Phase – 1 of the project. Successive work (design of BMM layer, Presentation layer, subject area, design of report and dashboard etc) for that phase is complete on top of that.
    Now, they would like to use Oracle database as source in Phase - 2, with the same table and column structure as MS Excel spreadsheet.
    We have created connection type of OCI 10g/11g and successfully imported the metadata of the oracle database in the physical layer.
    I was thinking whether it is possible to just redirect the source of physical layer from MS Excel to Oracle database, keeping the rest of the components (including BMM layer etc.) intact.
    This will be pretty tedious job to rebuild all layers of the RPD again and again for change in the underlying database.
    Please advise how this is possible. Many thanks !

    I think..we can do some testing
    you have created Alias for all tables.
    Try checking view data by changing the Source name of any alias table to Oracle Source name in the physical Layer.
    Check the datatypes of columns .
    If these two are passed we can eliminate rebuilding.
    Please post your comments.

  • Purpose of Reason for Change on Timesheets

    We are using PWA 2010 for time reporting.  There is a field on the timesheet called "Reason for Change".  The only value I believe I've ever seen in this field is "Not Delayed", however, other possible values (from a Lookup
    table) are "Under Estimated", "Access to Resources", "Assigned to higher priority work", "Technical issue", "Other".
    To my knowledge there is nothing anyone does at my company that changes/sets the value of this field.  Can someone help me understand how it is used? how it is set? its purpose?  I've been looking online but cannot find anything that
    talks about it.
    Thank you
      

    What you are seeing is a custom field, created by your Project Server administrator, or perhaps by a consultant who might have set up your Project Server 2010 system.  I can assure you that this field is NOT a default field.  So, I would suggest
    that you talk to your Project Server administrator to see if he/she set up this field.  And if not, then I would suggest you talk to your consultant.  And if nobody knows where this field came from, I would recommend that your Project Server administrator
    remove it from the Timesheet-related views in PWA and then that the field be deleted.  Just a thought.  Hope this helps.
    Dale A. Howard [MVP]

  • Listening for Changes to JTextArea

    I am writing a program that listens for changes to the contents of a JTextArea to obtain input for its execution. But I have implemented DocumentListener, PropertyChangeListener to listen for changes to the JTextArea for deriving input without success. Please could anyone advice on what to do.
    My code is below.
       myListener implements DocumentListener{
       JTextArea txt = new JTextArea();
       txt.getDocument().addDocumentListener(this);
       public void changedUpdate(DocumentEvent e){}
       public void removeUpdate(DocumentEvent e){} 
       public void insertUpdate(DocumentEvent e){
        try{
         //my code for obtaining input from txt is here
         int start = e.getOffset();
         Document doc = e.getDocument();
        }catch(BadLocationException ble){
    }

    Here's a link to the Swing tutorial on "How to Write a Document Listener":
    http://java.sun.com/docs/books/tutorial/uiswing/events/documentlistener.html

Maybe you are looking for

  • I upgraded my computer from Windows Vista Ultimate to Windows 7 Professional and I am attempting to install CS4 Web Premium.

    I downloaded the latest CS4 from the support site and installed, entering my registration number.  Installation seemed to go well but when I try to open Photoshop, I get a message that there are some files missing in the application folder and I must

  • Is anyone using a 1252 ap in bridge mode with channel bonding?

    Is anyone using a 1252 ap in bridge mode, with channel bonding? I had a question a while ago from a customer with regards to bridging with a 1252 ap to increase throughput for a wireless link he was using, from the throughput improvements in 802.11n.

  • Re: Asset Issue

    Hi All, Can any one tell me. my user has done asset transfer for that they are maitaining depreciation key Sum of the year digit/acq value, but system  shows straigth line method why its seems calculate in straigth line method. thanks venkat.

  • Screen Layout PR

    Dear all, Can we use User Parameters in SU01 to define which Screen Layout in PR is used. Thx Icuk Hertanto

  • Shuts down when suppose to be sleeping

    Macbook Pro 13in mid 2010 8GB Ram 750GB Seagate Momentus XT 7200 RPM drive OSX Yosemite 10.10 So I put my computer to sleep at night by using the Apple icon. About 12:05am it will start repeating the same information within the console until about 3: