What I don’t understand it’s why you would do this with a readline and a bunch of string comparisons instead of just readdir directly?
A couple of tips anyway:
- Try to name functions and variables a bit more self-explanatorily,
batchscript,filesystem,parameterandfilepathare all a bit opaque - Instead of chaining
x == "a" || x == "b" || ..., you can usex in ("a", "b", ...) -
readdiris (to best effort) OS agnostic, so you don’t need to check - Comments are good, but a comment that tells you which function is called on the next line doesn’t really add any information