Page 1 of 1

Get Sqlite file Modified Date and Time

Posted: Thu Aug 10, 2017 2:12 pm
by jalz
Hey Guys,

Need a little bit of help please. I'm trying to get the modified Date and Time of a sqlite file. Initially, after doing some research and reading the dictionary I thought I could somehow use the read from file command combined with the it variable to obtain this data somehow (wasn't sure how but thought I could parse through the data somehow). However after running my script, the it variable is always empty. I know the read from file command works with ascii and binary files, is sqlite a binary file (I thought all files on a computer were in binary format)

The code I am using is similar to the one below (I know the pathname is correct as I can read and write to my database fine with the same pathname I use)

Code: Select all

read from file specialFolderPath("desktop") & "/myDb.sqlite" until EOF
put it into field "Test"
Is there another command I should be looking for?

Thanks
Jalz

Re: Get Sqlite file Modified Date and Time

Posted: Thu Aug 10, 2017 3:08 pm
by Klaus
Hi Jalz,

do something like this (out of my head):

Code: Select all

...
put the folder into tOldDir
put urlencode("myDb.sqlite") into tFile
set the folder to specialfoderpath("desktop")
put the long files into tLF
put lineoffset(tFile,tLF) into tFound
put item 5 of line tFound of tLF into tModData
convert tModDate from seconds to date and long time
answer "DB File last modified at:" && tModDate
...
Check "files" in the dictionary for more fun with "long files".


Best

Klaus

Re: Get Sqlite file Modified Date and Time

Posted: Thu Aug 10, 2017 7:11 pm
by jalz
Awesome Klaus,

Your code works a treat :)- Thankyou