try this...
(note i deleted the last wire to the delete node - restore this once you are happy with what you see in the debug panel)
[{"id":"94f5e917.e6f958","type":"fs-ops-dir","z":"30e2e9e0.eeaab6","name":"","path":"path","pathType":"msg","filter":"filter","filterType":"msg","dir":"payload","dirType":"msg","x":1520,"y":460,"wires":[["794a07cc.866058","79c18d1.b5b7774"]]},{"id":"84075b2.9ce6da8","type":"inject","z":"30e2e9e0.eeaab6","name":"Settings *edit me*","props":[{"p":"topic","vt":"str"},{"p":"payload"},{"p":"path","v":"c:\\temp","vt":"str"},{"p":"filter","v":"*.gif","vt":"str"},{"p":"maxFiles","v":"5","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1330,"y":460,"wires":[["94f5e917.e6f958"]]},{"id":"794a07cc.866058","type":"switch","z":"30e2e9e0.eeaab6","name":"","property":"payload.length","propertyType":"msg","rules":[{"t":"gt","v":"maxFiles","vt":"msg"}],"checkall":"true","repair":false,"outputs":1,"x":1690,"y":460,"wires":[["1413b4cb.1fe89b"]]},{"id":"1413b4cb.1fe89b","type":"split","z":"30e2e9e0.eeaab6","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1370,"y":540,"wires":[["7bd1322d.959dcc"]]},{"id":"7bd1322d.959dcc","type":"fs-ops-stats","z":"30e2e9e0.eeaab6","name":"","path":"path","pathType":"msg","filename":"payload","filenameType":"msg","stats":"stats","sizeType":"msg","x":1520,"y":540,"wires":[["825e1062.9069"]]},{"id":"79c18d1.b5b7774","type":"debug","z":"30e2e9e0.eeaab6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1710,"y":400,"wires":[]},{"id":"e298bf3d.c8bf","type":"join","z":"30e2e9e0.eeaab6","name":"","mode":"custom","build":"array","property":"stats","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1370,"y":620,"wires":[["320f5a2.5f118a6"]]},{"id":"51cf956a.44b0dc","type":"debug","z":"30e2e9e0.eeaab6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1750,"y":680,"wires":[]},{"id":"825e1062.9069","type":"change","z":"30e2e9e0.eeaab6","name":"","rules":[{"t":"set","p":"stats.name","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"stats.path","pt":"msg","to":"path","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1720,"y":540,"wires":[["e298bf3d.c8bf"]]},{"id":"320f5a2.5f118a6","type":"function","z":"30e2e9e0.eeaab6","name":"sort and return oldest","func":"\nvar sorted = msg.stats.sort(function (a, b) {\n if (a.ctimeMs > b.ctimeMs) return -1;\n if (a.ctimeMs < b.ctimeMs) return 1;\n return 0;\n});\n\nmsg.filesToDelete = sorted.slice(msg.maxFiles);\nmsg.payload = msg.filesToDelete.map(e => e.name);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1560,"y":620,"wires":[["51cf956a.44b0dc"]]},{"id":"9de21e39.9b946","type":"fs-ops-delete","z":"30e2e9e0.eeaab6","name":"","path":"path","pathType":"msg","filename":"payload","filenameType":"msg","x":1770,"y":620,"wires":[[]]}]
The fix was to revers the comparison operators in the function.