FIleMaker supports a listing for the documents folder - get(DocumentsPathListing)
FOr the listing of an other folder, there are plugins or system calls needed
PLugins: MBS, Troi, BaseElements, etc
Their are many ways to do this and not enough information in your post to make any definitive recommendations.
What OS are you on?
Do you want a recursive listing if their are nested folders or just the file list?
How/when do you want to trigger the production of the list and what will you do in FM with the results?
What scripting languages or other programming tools are you comfortable with or are willing to invest time in learning?
Are you willing to invest time/money in buying a plug in or building a plug in of your own?
On a Mac the simplest solution is to use AppleScript through "perform Applescript". You can mix it with a bash command if you are more familiar with it.
On a PC you can use VBS or "Send Event" and cmd to get folder listing back to FileMaker.
If you use cmd or bash you will need to get folder listing back to FileMaker. I usually use clipboard, another option is to write out a text file and import it into FileMaker.
As the others mentioned, this is not dynamic, you would need something to refresh your list in FileMaker when it changes. You can use User Agents on a Mac to trigger script in FileMaker to update the folder list. I am not sure if Windows has similar functionality.
While I was typing the post the original question changed completely. Safely to ignore now.
The closest thing to an array in FileMaker is repeated field, but you are better off just keeping it as a list and use getValue() to access elements. You can also use getValue() to process your list into separate records or store it in the repeated field.
Not that the question has completely changed you are asking for text parsing solutions.
Please look at the text functions (right, left, middle, right words, left words, middle words, etc)
and the list functions (valuecount, get value etc) and the repositories of custom functions available on the web and learn how to perform text parsing in FM.
Its one of the most valuable tools in your toolbox.
if you use MBS Plugin, you could those functions.
Files.List gives list of files:
Files.ModificationDate gives modification date:
and Files.Delete can delete a file:
just 3 of 3000 documented functions in our plugin.
Nicolai is right on the point here.
You should use arrays (repeating fields) best when you know beforehand the maximum array length (how many elements) but what you have is an open ended list. No need to array it, you can move freely into it with $i ranging from 1 to ValueCount(list) and get the nth element with GetValue(list; $i).
$deleteAfterDays = 2
$i = 0
$listLength = ValueCount(list)
$today = GetAsDate(Get(CurrentHostTimeStamp))
exit loop if (let$i = $i + 1; $i > $listLength)
$filename = GetValue(list; $i)
$cleanFileNumber = Filter($Filename;"0123456789")
if Length($cleanFileNumber) = 8 // poor man's error trapping, has to be improved
$deleteme = ($today - date(middle($cleanFileNumber);3;2);Left($cleanFileNumber;2);Right($cleanFileNumber;4)) > $deleteAfterDays)
<< delete the file named $filename using your preferred plugin >>
Save the contents of the folder to a variable. And reference each file through GetValue( $yourDocumentList ; $AndALoopCount) but if you really want to explode it, then look into key/value custom functions which will explode the values into named variables after a little manipulation.