Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shell script help - get date of last modified file in hierarchy



On Mar 26, 2007, at 9:27 PM, Mark Walsh wrote:

I'm looking for a simple shell script to get the modification date of the
last modified file in a folder's complete hierarchy.


I'm trying to write a script to make sure that when a job is written to our
server, that I can make sure it has the most recent files. I already have
shell scripts that check the count of files in the hierarchy (as well as
logging the filepaths) and I would like to add a warning if it does not find
the same date for the last modified files in each folder.


Any help would be greatly appreciated.

Copy, paste, compile, run!

on open dropList
	tell application "Finder"
		if (count items of dropList) > 1 then return
		set folderRef to (item 1 of dropList) as alias
		if (class of item folderRef) is not folder then return
		--
		set mostRecentFile to ¬
			(item 1 of (sort (files of entire contents of folderRef) ¬
				by modification date)) as alias
		set mostRecentModDate to modification date of mostRecentFile
		--
		reveal mostRecentFile
		display dialog mostRecentModDate as text
	end tell
end open

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Shell script help - get date of last modified file in hierarchy (From: Mark Walsh <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.