Add support for limits to Files.GetDirectory

Also removes an unneeded loop.
Merge pull request #2366 from Tolriq/AddLimitsToFilesGetDirectory

jsonrpc: add support for limits to Files.GetDirectory