file attributes
Posted: Mon Jul 06, 2009 9:58 pm
How do I get the modified date of a file? Sorry if this has been posted, but I did not have any luck searching the forums.
Thanks,
wake
Thanks,
wake
Questions and answers about the LiveCode platform.
https://www.forums.livecode.com/
Code: Select all
on mouseUp
answer file "Select a file and I'll tell you the modification date"
if the result is "Cancel" then exit mouseUp
put it into theFilePath
-- extract the filename and folderpath
set the itemDelimiter to slash
put item 1 to -2 of theFilePath into theFolderPath
put item -1 of theFilePath into theFileName
set the itemDelimiter to comma
-- save and change the defaultfolder, read the detailed files, restore the defaultfolder
put the defaultFolder into theOldDefaultFolder
set the defaultFolder to theFolderPath
put the detailed files into theFileInfo
set the defaultFolder to theOldDefaultFolder
-- remove the file information that we don't need
filter theFileInfo with (URLEncode(theFileName) & ",*")
-- the fifth item is the modification date, expressed in seconds
put item 5 of theFileInfo into theModificationDate
convert theModificationDate from seconds to internet date
answer theModificationDate
end mouseUp