|
-
September 11th, 2006, 02:51 PM
#1
How long full path of a file may be...?
Hi, Pros!
I need to write to a file a full path of that file. But how long path may be.
I'm asking because I need to know maximum size which path takes in order
properly structure the innards of the file.
What doesn't kill us makes us stronger. F.Nietzsche.
-
September 11th, 2006, 03:19 PM
#2
Re: How long full path of a file may be...?
use MAX_PATH ( it's a #define in windows header file )
-
September 11th, 2006, 04:21 PM
#3
Re: How long full path of a file may be...?
 Originally Posted by kirants
use MAX_PATH ( it's a #define in windows header file )
Which is 260 characters.
-Greg Dolley
-
September 11th, 2006, 04:53 PM
#4
Re: How long full path of a file may be...?
There is a problem. Imagine you have a file which is very deeply in directory
tree. You can place a file as deep as you wish. Yes? Ok. If you can
bury a file so deep then it's path grew very long, isn't it. If so my path will
be more then 260 characters long? Or maybe I miss something?
What doesn't kill us makes us stronger. F.Nietzsche.
-
September 11th, 2006, 04:57 PM
#5
Re: How long full path of a file may be...?
 Originally Posted by sulacco
If you can bury a file so deep then it's path grew very long, isn't it.
As you say, If you can. So, question is, have you been successful in doing it?
-
September 11th, 2006, 05:05 PM
#6
Re: How long full path of a file may be...?
There is a problem. Imagine you have a file which is very deeply in directory tree. You can place a file as deep as you wish. Yes? Ok. If you can
bury a file so deep then it's path grew very long, isn't it. If so my path will
be more then 260 characters long? Or maybe I miss something?
Well, if the Windows API won't support paths longer then 260 characters (MAX_PATH), I would think that this is not an issue (since you can't do it).
Viggy
-
September 12th, 2006, 10:46 AM
#7
Re: How long full path of a file may be...?
Ok. I will check it right now....wait...
What doesn't kill us makes us stronger. F.Nietzsche.
-
September 12th, 2006, 10:57 AM
#8
Re: How long full path of a file may be...?
I think this is possible to do, but you have to really want to do it.
First create a very deep directory structure.
Then using a utility like junction from Sysinternals create a symbolic link to the deepest directory.
Then accessing this directory from the symbolic link continuing creating your deep directory structure.
In the end you should end up with a directory path that is longer than 260 characters.
To access that directory I think you have to preappend the path with
\\\\?\\
so something like \\\\?\\c:\\...your really long path here\\mytextfile.txt
HTH
-
September 12th, 2006, 01:12 PM
#9
Re: How long full path of a file may be...?
One filename (e.g. myfile.txt) can have a maximal length of 255 unicode character under NTFS. Although the complete path name can have a maximum length of 32,767 unicode characters. See this for info and comparison.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|