• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
last modified file - how to catch?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

last modified file - how to catch?


  • Subject: last modified file - how to catch?
  • From: Omar K N <email@hidden>
  • Date: Mon, 07 Jul 2014 16:47:07 +0200


On 07 Jul 2014, at 16:21, email@hidden wrote:

Date: Mon, 07 Jul 2014 15:11:29 +0200
From: Emmanuel LEVY …

You already got several useful replies,

Yes and I’m thankful for everyone on the list!

you may also want to know that the shell command "ls" accepts a "-t" option to sort files by modification date, so that you would get the last modified file with:

first paragraph of (do shell script "ls -t " & (quoted form of (posix path of (alias "MacHD:Users:okn:Documents:_Output:"))))

All the best!
Emmanuel


Thank you Emmanuel!
-- 


When I run: 

set _path to POSIX path of (path to downloads folder as text)
set lastModifiedFile to first paragraph of (do shell script "ls -t " & (quoted form of (POSIX path of (alias "MacHD:Users:okn:Documents:_Output:"))))
--this part works by itself: the files are sorted!

then this is ok. But when I tell TextEdit:

set _path to POSIX path of (path to downloads folder as text)
set lastModifiedFile to first paragraph of (do shell script "ls -t " & (quoted form of (POSIX path of (alias "MacHD:Users:okn:Documents:_Output:"))))
--this part works by itself: the files are sorted!
tell application "TextEdit"
open lastModifiedFile
end tell
-- AS displays the file as Valiable Value, but then:
-- error: The doc "AE911….txt does not exist.

I get the error: The doc "AE911….txt does not exist,” 
although AS displays the file as Variable Value.

So how to tell AS to open the last modified file?

with best regards,
Omar K N
Stockholm, Sweden
( I’ve still problem with the correct path, when not such obvious folders as downloads folder)
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: Re: last modified file - how to catch?
  • Next by Date: Re: last modified file - how to catch?
  • Previous by thread: Re: last modified file - how to catch?
  • Next by thread: Re: last modified file - how to catch?
  • Index(es):
    • Date
    • Thread