Posted By

kenray on 11/14/08


Tagged

file stdLib


Versions (?)

stdFileInfo


 / Published in: Revolution
 

URL: http://tech.groups.yahoo.com/group/revInterop/

This is part of the Revolution Standard Library.

  1. function stdFileInfo pFilePath,pOpt_InfoItem
  2. if pOpt_InfoItem "" then
  3. if pOpt_InfoItem is not among the items of "full,fileName,dataSize,resSize,createDate,modDate,accessDate,BUdate,ownerID,groupID,permissions,creatorType,size,creator,type,array" then
  4. return "StdLibError: '" & pOpt_InfoItem & "' is not a valid file property."
  5. end if
  6. end if
  7. set the itemDel to "/"
  8. put urlEncode(last item of pFilePath) into tItem
  9. delete last item of pFilePath
  10. put the directory into tOldDir
  11. set the directory to pFilePath
  12. put the detailed files into tDetailedList
  13. set the directory to tOldDir
  14. set the itemDel to ","
  15. put lineOffset(cr&tItem&",",cr&tDetailedList) into tLine
  16. put line tLine of tDetailedList into tDetailedInfo
  17. if pOpt_InfoItem = "" then return tDetailedInfo
  18. replace "," with tab in tDetailedInfo
  19. set the itemDel to tab
  20. put tDetailedInfo into tFileA["full"]
  21. put urlDecode(item 1 of tDetailedInfo) into tFileA["fileName"]
  22. put (item 2 of tDetailedInfo) into tFileA["dataSize"]
  23. put (item 3 of tDetailedInfo) into tFileA["resSize"]
  24. put (item 2 of tDetailedInfo) + (item 3 of tDetailedInfo) into tFileA["size"]
  25. put "createDate,modDate,accessDate,BUdate" into tDates
  26. replace "," with tab in tDates
  27. repeat with x = 4 to 7
  28. put item x of tDetailedInfo into tSecs
  29. if tSecs "" then convert tSecs to short date and time
  30. put tSecs into tFileA[(item x-3 of tDates)]
  31. end repeat
  32. put (item 8 of tDetailedInfo) into tFileA["ownerID"]
  33. put (item 9 of tDetailedInfo) into tFileA["groupID"]
  34. put (item 10 of tDetailedInfo) into tFileA["permissions"]
  35. put (item 11 of tDetailedInfo) into tFileA["creatorType"]
  36. put (char 1 to 4 of item 11 of tDetailedInfo) into tFileA["creator"]
  37. put (char 5 to 8 of item 11 of tDetailedInfo) into tFileA["type"]
  38.  
  39. if pOpt_InfoItem = "array" then
  40. return tFileA
  41. else
  42. return tFileA[pOpt_InfoItem]
  43. end if
  44. end stdFileInfo

Report this snippet  

You need to login to post a comment.