473,395 Members | 1,631 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

System.IO.PathTooLongException

A routine I have that grabs all file names (fully qualified) from a
directory tree is getting the above error. The error message says: "The
path is too long after being fully qualified. Make sure path is less than
260 characters."

This is clearly a system limitation built into the framework. Has anyone
been able to overcome this limitation? Has anyone a work-around for this?

Thanks.

GS

Mar 9 '07 #1
3 4368
On Mar 8, 5:47 pm, "George Shubin" <d...@dxonline.comwrote:
A routine I have that grabs all file names (fully qualified) from a
directory tree is getting the above error. The error message says: "The
path is too long after being fully qualified. Make sure path is less than
260 characters."

This is clearly a system limitation built into the framework. Has anyone
been able to overcome this limitation? Has anyone a work-around for this?

Thanks.

GS
#define MAX_PATH 260

WinDef.h. Windows limits path lengths to 260 characters.

--
Tom Shelton

Mar 9 '07 #2
From MSDN

Note The C Runtime supports path lengths up to 32768 characters in length,
but it is up to the operating system, specifically the file system, to
support these longer paths. The sum of the fields should not exceed
_MAX_PATH for full backwards compatibility with Windows 98 FAT32 file
systems. Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP
Professional, Windows Server 2003, and Windows Server 2003 NTFS file system
supports paths up to 32768 characters in length, but only when using the
Unicode APIs. When using long path names, prefix the path with the
characters \\?\ and use the Unicode versions of the C Runtime functions.

Cor
Mar 9 '07 #3
On Mar 8, 11:13 pm, "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl>
wrote:
From MSDN

Note The C Runtime supports path lengths up to 32768 characters in length,
but it is up to the operating system, specifically the file system, to
support these longer paths. The sum of the fields should not exceed
_MAX_PATH for full backwards compatibility with Windows 98 FAT32 file
systems. Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP
Professional, Windows Server 2003, and Windows Server 2003 NTFS file system
supports paths up to 32768 characters in length, but only when using the
Unicode APIs. When using long path names, prefix the path with the
characters \\?\ and use the Unicode versions of the C Runtime functions.

Cor
hmmm, i've always just used max_path :) My guess is the that the
framework is actually using the unicode api calls underneath anyway
(at least on NT based systems). So, maybe just prefixing the paths
with "\\?\" would do the trick?

--
Tom Shelton

Mar 9 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Terrence | last post by:
I am doing some of the C# walkthroughs to transition from VB to C#. When I try to execute static void Main() { Aplication.Run(new Form1()) } I raise a 'System.NullReferenceException" in...
5
by: laks | last post by:
Hi I have the following xsl stmt. <xsl:for-each select="JOB_POSTINGS/JOB_POSTING \"> <xsl:sort select="JOB_TITLE" order="ascending"/> This works fine when I use it. But when using multiple...
2
by: Justin | last post by:
Hi. I'm writing a little c# program to list all the files in a selected directory longer than a given size. The problem is that when it finds a file that is too long for Windows, I get the...
0
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at...
1
by: Sky | last post by:
Yesterday I was told that GetType(string) should not just be with a Type, but be Type, AssemblyName. Fair enough, get the reason. (Finally!). As long as it doesn't cause tech support problems...
0
by: Johan Delimon | last post by:
Hello, Ever got this error? The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248...
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
6
by: Zytan | last post by:
I got a System.IO.IOException in my app on another computer, so I couldn't debug it. I don't think it was a HD error. What else could throw this? Could it be from reading a webpage from the...
5
by: Gillard | last post by:
hi , i try to io.file.delete(startmenushortcut) i get PathTooLongException how to delete those dead links in my start menu please
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.