cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar

Path to long for Files in Directory() ?

I came across the following problem while trying to access some files:

Due to some directory structures the path to the desired directory can be greater than 134 characters. If the path is 134 characters long or shorter, file in directory() has no problem of listing the files in the directory, but if its longer than 134 (same parent directory) the list is empty. I already checked my permissions and there is everything fine. I also can't find these files in the directory if i use the File->Open within JMP. Is there a buffer problem or maybe something else?

1 ACCEPTED SOLUTION

Accepted Solutions
jschroedl
Staff

Re: Path to long for Files in Directory() ?

Sorry that you hit this issue. Can you tell us which version of JMP you are using? 

 

Windows paths have an historical limit of 260 characters for the full path. It's possible that the OS APIs we're using are truncating things and the only fix there is a shorter overall path as was suggested. Or, there could be a bug in Files In Directory.

 

Do you know the length of the full parent path down to the problematic folder? If that length (including the drive and \ chars) + the 134 of the directory you are enumerating goes over 260, the names will get truncated from the OS.

 

Since you may wonder: We do have a wish list item to support long file names in the future but that is quite complicated as the long paths are structured differently than normal paths. They are prefixed with \\?\, for example. Also, there is a LOT of code which deals with files which would need to be rewritten. Supporting long names would also require you to edit the registry to enable it the machine. 

View solution in original post

9 REPLIES 9
jthi
Super User

Re: Path to long for Files in Directory() ?

Are files hidden? Does this only happen with this specific folder? Which operating system are you using? Which JMP version are you using? How long are your file names? Are you sure file format is set correctly?

jthi_0-1756133684978.png

 

-Jarmo

Re: Path to long for Files in Directory() ?

Okay when trying to find the files using "open" within JMP I forgot to set the dropdown to "All Files". But still with the script I cant find it. I'm on Windows and this happens only on those folders where the path is greater than 134 characters. So in the same directory but with a folder where the name of the folder is shorter, so the complete path is less than 134 it works. Im using 18pro Version. What do you mean by "file format is set correctly"

jthi
Super User

Re: Path to long for Files in Directory() ?

The drop down is what I mean by the file format as you said JMP's Open wasn't able to see the files. Have you tried with different parameters with Files In Directory Files In Directory(path, <Recursive(Boolean)>) , there is also one for hidden files (at least according to scripting index).

-Jarmo

Re: Path to long for Files in Directory() ?

Yes I tried all the options already but no success.. I guess this is just a JMP restriction 

jthi
Super User

Re: Path to long for Files in Directory() ?

You could contact JMP support. I haven't had such issue when using Files In Directory

 

View more...
Names Default To Here(1);

path = "$DOWNLOADS\New folder\New folder (4)\New folder (4)\New folder (4)\New folder (4)\New folder (4)\New folder (4)\New folder (4)\New folder (4)\New folder (4)\New folder (4)\New folder (4)\New folder (4)\New folder (4)\New folder (4)\";

Show(Length(path), Files In Directory(path));

jthi_0-1756207414385.png

 

 

 

 

-Jarmo

Re: Path to long for Files in Directory() ?

Crazy Yeah I've already contacted them, they said I can just copy the directory to a place where the path is shorter and delete it afterwards

jschroedl
Staff

Re: Path to long for Files in Directory() ?

Sorry that you hit this issue. Can you tell us which version of JMP you are using? 

 

Windows paths have an historical limit of 260 characters for the full path. It's possible that the OS APIs we're using are truncating things and the only fix there is a shorter overall path as was suggested. Or, there could be a bug in Files In Directory.

 

Do you know the length of the full parent path down to the problematic folder? If that length (including the drive and \ chars) + the 134 of the directory you are enumerating goes over 260, the names will get truncated from the OS.

 

Since you may wonder: We do have a wish list item to support long file names in the future but that is quite complicated as the long paths are structured differently than normal paths. They are prefixed with \\?\, for example. Also, there is a LOT of code which deals with files which would need to be rewritten. Supporting long names would also require you to edit the registry to enable it the machine. 

Re: Path to long for Files in Directory() ?

Thanks for the reply, I do know that this isn't really a thing that JMP can easily change so no hate to your side. I'm using JMP 18pro if this helps. As I said, the current method is to copy the folder to an other place where the path is really short, then doing what I need to do and deleting it afterwards. The parent path that doesn't work is 134 characters, but this doesn't include the fact, that the folder is in user->network->drive this part isn't shown in the path

MathStatChem
Level VII

Re: Path to long for Files in Directory() ?

I have had a similar problem in the past (with other software), and I solved it by mapping the long file path to a lettered drive (e.g. X:) and then using that shorter path. 

Recommended Articles