Page 1 of 1

File Information for a specific folder

Posted: Sun Apr 29, 2018 7:57 pm
by lohill
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

Re: File Information for a specific folder

Posted: Sun Apr 29, 2018 9:40 pm
by bogs
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])

Re: File Information for a specific folder

Posted: Mon Apr 30, 2018 1:53 am
by lohill
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

Re: File Information for a specific folder

Posted: Mon Apr 30, 2018 2:52 am
by bogs
It isn't as ugly as some of the stuff i've written :wink: