Long File Names using \\?\ is nuisance, any alternatives


I am using Delphi Xe2 and I need to use \\?\ to access files with deep folders.
I have to check my code and where ever there is User Interface I need to show without  \\?\  and whereever internal processing I need to use with \\?\.

Is there any better option.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sinisa VukSoftware architectCommented:
Use ExpandUNCFileName to get full path with computer name:

and ExpandFileName for internal use:

Allan_FernandesAuthor Commented:
I meant where filename > 255 chrs
Geert GOracle dbaCommented:
does anybody actually type in such a long file name ?
get serious !
there is a reason why it's limited to 255 chars:
  the human brain can't remember a path longer than that
how many times per day does anybody ask if they still know that path name ?

same problem here. in the end they had to admit they used shortcuts to the folder ...

if it's on a \\ path
create a shared folder on that server to the common deepest level it can go
then start from there

> share named "ooo" on server to c:\a\b\c\d\e\f\g\h\i\j\k\l\m\o

this then changes to
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Allan_FernandesAuthor Commented:
Since windows allows such paths users create it. I have a backup application, if I cannot backup the data then User does not purchase my package. I loose the client without any chance of explaining to him how he can make use of Shared folders.

What I need to know is, if there is a common logic that I can use for standard files and the ones > 255.
Sinisa VukSoftware architectCommented:
There are similar topics here:


...using unicode version of delphi (xe2 will do fine) and switch between \\?\ and local fine name with simple StringReplace function

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Geert GOracle dbaCommented:
have you considered backing a system with a synchronous DR system  in place ?

the data ... most data resides in databases
the data files usually require a databases specific mechanism to do backups

windows ... so your software can restore a complete windows environment
without having access to the windows system itself ?

i hope you considered all those questions ... :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.