I am currently writing a small program to parse a directory structure and retrieve some data from files in that structure. The files of interest are not always in the same consistent location, so I have to search for them, and to do so, I make extensive use of the dir function.
I have come up against an issue, which I don't know how to solve. For some files, I get the following warning when calling the dir function:
warning: dir: 'lstat (P:\9xxxProjects\blabla\blabla\blabla\blabla\blabla\blabla\blabla\long_filename)' failed: No such file or directory
and the resulting elements in the structure output from dir are:
ans = .
ans = ..
ans = [](0x0)
ans = [](0x0)
ans = [](0x0)
ans = [](0x0)
ans = [](0x0)
which makes my code error out.
Now, I have created a test directory in the base C:\ drive (C:\Test), copied the files across, and without changing anything else (i.e. leaving the file names unchanged), ran the same code. It ran just fine, no issues with dir.
Is there a maximum path/file length that is supported by dir? How can I work around this problem? I cannot change the naming convention of either directory structures or the file names. The length of the path to the problem directory is 177, the length of the file names that give me problems is 84, so a combined length of 261. Other files in that same directory, of length 81 (so combined length of 258), work just fine. Is there a maximum length of 260 characters somewhere in the code?
Thanks in advance,
Arnaud
PS: am using Octave 3.8.0 on Windows