File Information for a specific folder

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
lohill
Posts: 726
Joined: Tue Dec 08, 2009 6:37 pm
Location: San Diego, CA USA

File Information for a specific folder

Post by lohill » Sun Apr 29, 2018 7:57 pm

In the message box I can type "put the long files" and it gives men some information about the files in what I assume is some directory somewhere. This is what I see:

Divvy.db,12288,0,1507315414,1507315428,1516045393,0,501,20,644,
miSample.sqlite,0,0,1507853111,1507853111,1507853111,0,501,20,644,

I recognize this files as mine but I'm not sure what directory they are in but I assume that it is currently what is being pointed to. Is there a way I can use 'long files' to get the same type of information for a specific directory and a specific file.

If I have just used "answer file" and have the path of the file I would like to open. But I would also like to get the 'long file' information for that file because item 5 of that data is the date in seconds when the file was last modified.

Thanks for any help,
Larry

bogs
Posts: 2067
Joined: Sat Feb 25, 2017 10:45 pm

Re: File Information for a specific folder

Post by bogs » Sun Apr 29, 2018 9:40 pm

In general, what you typed in the message box will be referring to the files listed in the 'defaultFolder', which varies from OS to OS, and can be changed by specifying a new defaultFolder.
*Edit - to find out the current defaultFolder, you can type in the messagebox

Code: Select all

put the defaultFolder
You didn't mention what OS your using, but some helpful terms to look up in the dictionary would be files

Code: Select all

// Syntax - 
the [{ detailed | long }] files
---------
files([targetFolder])
... and folders

Code: Select all

// Syntax - 
the [{ detailed | long }] folders
---------------
folders([targetFolder])
Image

lohill
Posts: 726
Joined: Tue Dec 08, 2009 6:37 pm
Location: San Diego, CA USA

Re: File Information for a specific folder

Post by lohill » Mon Apr 30, 2018 1:53 am

Thanks bogs,

I ended up creating a function that looks like this:

Code: Select all

function getDateFromFile pPath
   set the itemdelimiter to "/"
   put the last item of pPath into tFile
   replace space with "+" in tFile
   put item 1 to -2 of pPath into tPath
   set the defaultfolder to tPath
   put  the long files into tFileList
   put lineOffset(tFile,tFilelist) into tLineNum
   if tLineNum > 0 then
      set the itemdelimiter to comma
      put item 5 of line tLineNum of tFileList into tReturn
      convert tReturn from seconds to  long date
   end if
   return tReturn
end getDateFromFile
It is not very pretty but appears to do what I want.

Larry

bogs
Posts: 2067
Joined: Sat Feb 25, 2017 10:45 pm

Re: File Information for a specific folder

Post by bogs » Mon Apr 30, 2018 2:52 am

It isn't as ugly as some of the stuff i've written :wink:
Image

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”