Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Max Length of Unc FilePath valid in VFP9?

Max Length of Unc FilePath valid in VFP9?

Max Length of Unc FilePath valid in VFP9?


Anyone know what the max length of a UNC file path name usable with vfp commands?

For years I have used... "H:\CountyName\CountyClerk\BailBond\1\Index\123-2.tif" where county name can be up to 24 chars long, CountyClerk can be 24 chars, BookType is 40 chars, BookNum is 24 chars, Prefix can be 24 and file name is 24 as well. The user definable parts all adds up to 160 (24+24+40+24+24+24) if all fields were filled to their max.

Now I need to change "H:" to a unc which can just as long which would exceed normal limits something like... "\\Dasnew\mssqlserver\DocumentsDataFS\DocumentsDocStore\Zeslie\CountyClerk\BailBond\1\Index\123-23.tif" This particular unc is easily in within limits...

So, what kind of limits do I need to know about?

Stanley Barnett

RE: Max Length of Unc FilePath valid in VFP9?

In principle, 260 (represented by the constant MAX_PATH) is the safe and workable limit.

VFP can work with file objects stored in paths with greater depth than MAX_PATH, but that must be translated at least in some of their segments to DOS short names.

RE: Max Length of Unc FilePath valid in VFP9?

I agree, to not need to worry about this, you could define shares. The client don't need to map them to drive letters, but will profit from shorter UNC paths anyway, as \\Dasnew\Sharename obviously is shorter than eg\\Dasnew\mssqlserver\DocumentsDataFS\DocumentsDocStore, if you make that a share.

Bye, Olaf.

RE: Max Length of Unc FilePath valid in VFP9?


The string "mssqlserver\DocumentsDataFS\DocumentsDocStore" is created automatically when creating a FileTable in SQL 2012 and above. That could be shortened some by shortening Documents to docs, but the other parts (mssqlserver, *DataFS and *DocStore) is what SQL server automatically creates and tends to be lengthy, which is why I asked the question here.

And Olaf, for error handling, I DO need to worry about this if VFP is doing something with it such as viewing a file at the other end of a long unc???? Once I get the max unc length that vfp can handle, I can then test the total unc length as the client is inputting values into the fields they have control over and compare its length against the max value.

So, is everyone saying that 260 is the max safe value to use with VFP9?


RE: Max Length of Unc FilePath valid in VFP9?

Even if you create FileTables on the fly, it's possible to create shares on the fly and with code, too.

Setting up Filetables on the fly is not what anyone needs, though. First of all FileTables themselves have to be allowed and have to be configured overall and what I know is you can define a base path valid for all FileTables. And you can make that a share being a shortcut UNC name for access outside of SQL Server. Besides of course SQL Server can hand out the files, too, but yes, the feature to allow both normal folder access via file system and via T-SQL is a feature you can use. You typically wouldn't let SQL Server generate random paths, to work with that feature.

On the subject of the limit: It does appear in the help topic of DisplayPath(), I've seen it mentioned for NTFS, so it's not a VFP, but a NTFS limit.
Unsure if this is valid for UNC, too, it is valid for local paths/filenames.

Also see https://mspoweruser.com/ntfs-260-character-windows...

Bye, Olaf.

RE: Max Length of Unc FilePath valid in VFP9?

The limit is system defined, but even although the \\?\<path> construction already allowed for extra-length filenames (close to 32k strings), I think that VFP still respects the MAX_PATH limit.

I don't know if it is possible under your constraints, but you may consider using an external class, like Shell.Application or Scripting.FileSystemObject, to copy the files to a safe place, like SYS(2023), and then process the data from there.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close