Hello, I am working on a general handler for you, not just for this case, so I wanted to know if you could give me some feedback about the specification below?
– Work in progress
to fileList(R)
end fileList
-- example call :
set xlFiles to fileList({sType:"file", sDepth:1, sPred:"regexp", sExt:{"xlsx", "xlsm", "xlsb"}, sTerm:"^Week.*$", spath:theFolder})
– Properties of R the parameter for filelist of type record:
– ====================================================
– sTerm: type string: MANDATORY
– The searchterm you are looking for, an empty search term will be interpreted as “" (all files).
– When it comes to specifying search terms the new type of regexp are allowed, so you can use
– terms like "expenses second quarter 200(4|5|6).” or “expenses second quarter [[.201.]](0|1|2).*”
– See man grep under the -E option and much better man re_format(7).
– sPath: type string: MANDATORY
”””””””””””””””””””””””
– The searchterm is a posix path or hfs path (hierchial file sysem path) to a directory that must exist,
– it can end with “/” or “:” or not.
– sType: type string
– What to search for: “file”,“folder” or “both”. Optional, “file” is the default value.
– sDepth: type integer
– The depth of the search. Optional; defaults to 1.
– 1 specifies that the search is just to be performed in the given directory,
– just a positive number gives the number of levels to search, or the levels up that number.
– ( sed ‘d’ for større nivÃ¥er )
– (-1) is the full subtree below the given directory, all levels.
– sPred: type string
– The search predicate, specifies how the handler will interpret and use the searchTerm.
– Optional; defaults to “regexp”.
– If there are no extension given, then the searchterm will specify the full pattern to search
– for. Legal values:
– “starts with”:
” Matches files/folders that starts with the search term.
” “ends with”:
” Matches files/folders that ends with the search term, it is not smart in the sense that it will not match up to
” an extension, if none are given, if this is what you want, then you’d specify an sExt of “”. This is not default, as
– some like the mother, other prefers the daughter!
” Example:
– if your specify ends with, and the filename is hackerne.ws and you search for “ws”, without an extension, then ”
” you will miss this file.
– “Contains”:
” Matches files/folders that contains the searchterm somewhere (see Ends with.)
– “Exact”:
” Exact match.
” “Regexp”:
” The whole regexp is solely provided by the user, either with or without sExt, but considering it if it is there. if
” you want all files, then don’t specify the sExt, set sPred to “regexp” and sTerm to “” or “*”.
– sExt: type list
– The search extension, specifies which extension the file/folder list will be filtered against.
– It works in conjunction with sTerm, it takes a list of file extensions, spelled fully out.
– Example: {“xls”,“xlsm”,“xlsx”,“xlsb”} is a valid list of extensions{“xls[bmx]”} is discouraged
– but it works.
– Optional parameter, default value {“*”} which means that any extension is allowed, but you must
– specify and extension of {“”} to make sure that nothing will be interpreted as extensions though.
– sVisible: type boolean
– If invisible files are to be included or not. Optional, defaults to not include invisible files.
– Returns a file list:
– ====================
– The file list will be returned in the format the search directory was given, posix path, or hfs.