Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Max Length of Unc FilePath valid in VFP9?

Status
Not open for further replies.

stanlyn

Programmer
Sep 3, 2003
945
US
Hi.

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

Example:
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?

Thanks,
Stanley Barnett
 
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.
 
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.
 
Hi,

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?

Thanks,
Stanley

 
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
Bye, Olaf.
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top