Your assumption that the script runs with FMS privs is not correct, it runs with the same credentials as the user calling the script. Try with "allow user abort[off]", capture and store the error immediately after the Get(documentspathlist) to see if it generates an error.
I don't think I'd expect the user to have access to the FMS docs folder, it's not a server-side scheduled script. The function is not supported in WebDirect, it does not explicitly mention PSoS.
Is this on OSX?
Ths is OS X.
It ran OK as server sceduled script once I added "allow user abort[off]"
It also found that the file startup script is run first and that had a couple of error generating steps (e.g Resize window) which I dsabled just in case.
The documents folder contains about 30,000 small .csv files which I have to make list of, and then selectively import the data from. I was using applesctipt to list the files but it is very slow: FM retrieves the list in about 10 seconds.
It also found that the file startup script is run first and that had a couple of error generating steps
This is a common gotcha. Startup scripts are often designed for GUI and user based configuration, all of which is unneeded on the server. Get into the habit of adding a test for the application version at the beginning of the onFirstWindowOpen scripts so that you can exit if your are running on the server.
As a side note, use Base Element Plugin that allows to do system commands, it runs server side, it's free, it's awesome. I've 40 Applescripts that I'm converting to command line instruction, and it works greate, and of course helps me to make my script server side aware and ditch some FMP Bots
Does it work server side and allow you to manipulate files OUTSIDE the FMS Data Directory?
That would be cause for some comment, I would think.