Page 1 of 1

Is there a limit to the depth a path can have?

PostPosted: Mon Mar 18, 2013 3:52 pm
by mejiag
Hi, all. I am trying to write the file named GE-Speak-Wagner.wav using the filewrite command. When I give it the following path:

\\files.wedr.edu\studentswork\Language\Tests\CollectionBox\2013\112-01-Smith\Wagner-John\Speak\

Nothing gets written. If, however, I remove the last folder of the path and give it the following path:

\\files.wedr.edu\studentswork\Language\Tests\CollectionBox\2013\112-01-Smith\Wagner-John\

The file gets written no problem.

My question is: is there limit to the length (either in characters or in levels of depth) that a path can have with this command? Also, does filewrite return an error message that can be trapped?

I would appreciate any help with this.

Re: Is there a limit to the depth a path can have?

PostPosted: Mon Mar 18, 2013 6:27 pm
by dpayer
Two points.

1) try to manually write a file to that same longer path. Is there any problem doing that with another program (example word processor)?

2) try shortening the path with the DOS subst command. You can google it for details. Here is the help:

C:\WINDOWS\system32>subst /?
Associates a path with a drive letter.

SUBST [drive1: [drive2:]path]
SUBST drive1: /D

drive1: Specifies a virtual drive to which you want to assign a path.
[drive2:]path Specifies a physical drive and path you want to assign to
a virtual drive.
/D Deletes a substituted (virtual) drive.



You use this in a batch/cmd file in the following manner: subst "\\files.wedr.edu\studentswork\Language\Tests\CollectionBox\2013\112-01-Smith\Wagner-John\Speak\" d:\myspecialpath

and then write your file to d:\myspecialpath\GE-Speak-Wagner.wav

Re: Is there a limit to the depth a path can have?

PostPosted: Thu Mar 21, 2013 6:48 am
by mejiag
Thank you dpayer. I don't think this solution would work because that shortened path would exist only in the local computer, which would create a problem for distribution of the product.

I still would like to know if there is a limit to the length of a path.

Re: Is there a limit to the depth a path can have?

PostPosted: Thu Mar 21, 2013 7:17 am
by dpayer
mejiag wrote:Thank you dpayer. I don't think this solution would work because that shortened path would exist only in the local computer, which would create a problem for distribution of the product.

I still would like to know if there is a limit to the length of a path.


Are you attempting to write this file over the internet? If you are, the FileWrite command cannot work, it is intended for Windows based network connections over a LAN. Writing to a server over the internet will require you to use the available functions of that server, be they http-->php/asp upload or FTP.

Regarding length of path, that is determined by the OS. What appears to you as a path to a server resource may actually be using a shortened path (via renamed resource) so efforts to write to it may exceed the limits of the OS even though it looks proper. Typical max path for windows is 260 characters.

http://windows.microsoft.com/en-us/wind ... questions#

I have never run into an issue of path length limits (beyond that of the OS) with NB.

David P.