Is there a way to create a log?

I want to create a simple log in TextEdit using Applescript.

I want to know if there is simply a way to find out what files have been opened, edited, moved, or trashed in a given week.

I hope this is not complicated, but it would be good to know and have some sort of record like:

File: Date Last Opened: Date Modified: Date Moved: Date Deleted:
project.doc 26 April 2013 26 April 2013 ----------------- --------------------
image.jpg 25 Aril 2013 10 Dec 2001 21 Jan 2013 -------------------

Hello.

I think it is possible to make something that works on a directory basis, even if files are moved, given that the files are moved in such a way that the original inode number is preserved, but you have no guarrantee that that is the case when you open the file from an app, as I believe most apps create a new file when the files are moved.

You may look into the comm utility: (man comm) but it won’t show chronological output. There are some scripts in the “Unix Programming Environment” by Brian W. Kernighan and Rob. Pike that shows the how to implement a parallell to this, or the script comes by as an excercise. I believe that shell script is named “watchfor”

You should really get hold of that book, and customize that script to work under a launch-agent onto a directory.

Edit

This sounds a bit fun (like everything I mustn’t do, and useful too, :slight_smile: so I’ll see if I can make a shell script work, that does almost all of above. Which you can run in a directory at a time. That is you can have one LaunchAgent, with multiple watchpaths, that will trigger the shell script in the correct folder, hopefully.

I’ll also toss in a column for “Date added”.

You’ll have to open the resulting file in TextEdit yourself, and you won’t be able to see where the files moved to.

You should be able to search this fora for the hows of how to create a LaunchAgent, that triggers the shell script every time the file changes.