Don't know what the problem is with exceeding N=1000. Works for me:
path = "data/"
files = [ dir(fullfile(path,'**','*.txt')); dir(fullfile(path,'**','*.txt')) ];
N = numel(files)
Gives this result for my datafolder:
As I assume you want to rename files or something, you can now just iteratively work on them.
However the following will get you into trouble:
Warning: Number of elements exceeds maximum flint 2^53-1.
The result may be inaccurate.