Re: oldest file of folder1
Re: oldest file of folder1
- Subject: Re: oldest file of folder1
- From: "Adam K. Wuellner" <email@hidden>
- Date: Tue, 1 Feb 2005 17:39:37 -0600
On Feb 1, 2005, at 5:06 PM, Robert Poland wrote:
This script;
tell application "Finder"
set folder1 to choose folder
set f to POSIX path of folder1
set the_oldest to last paragraph of (do shell script "ls -t " &
quoted form of f)
set the_oldest to POSIX path of folder1 & the_oldest
get {label index} of file the_oldest
Is there a missing POSIX ^ in there? I see double spaces, but...
set x to result
...
gets the proper file name but I can't seem to figure out how to use
it. I get an error; "Can't get label index of "dcp_460.jpg".
Modified a bit:
tell application "Finder" to set folder1 to choose folder
-- the remaining operations do not call for Finder,
-- so the tell block was shortened to a tell line
-- ...personal preference, lacking a better argument at the moment...
set f to POSIX path of folder1
set the_oldest to last paragraph of (do shell script "ls -t " & quoted
form of f)
set the_oldest to POSIX path of folder1 & the_oldest
-- above three lines unaltered
set the_oldest to POSIX file the_oldest as string
-- added the above line to cast the_oldest as a POSIX file, and that,
in turn, as a string
-- which means the_oldest is now a (string) Mac-style path to the
oldest file
tell application "Finder" to get {label index} of file the_oldest
-- now the string can be cast, by Finder, as a Finder file class object
set x to result
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden