From: Alex LeDonne Date: 2008-01-23T05:00:15+09:00 Subject: Re: No such file or directory - bug due to filepath length? On Jan 22, 2008 2:39 PM, wrote: > > What is the FULL path of backup_dir? > > > > The full path is: > C:\Documents and Settings\fensterb001\Desktop\projects > \eclipse_workspace\pwdmgr\backup\deployer\172.16.11.33\opt\jboss\server > \default\deploy\birtdaemon.war\WEB-INF\plugins > \org.eclipse.birt.report.data.oda.jdbc_2.1.1.v20070205-1728\drivers\ > > That is 239 characters. "abcdefghijklmnopqrst" is 20 characters long, > resulting in 259 total characters for the successfully created file. > > If there is a 256 character limit, where is this limit referenced? I > can't seem to find any references to it in the Core Reference. In > Windows, we can easily create files with filepaths greater than 256 > characters; I would also expect this case to be handled successfully > by File.open(). > > (Sidenote: I did move the backup directory to C:\backup, and that > worked around the issue) Well, I don't think the 'C:\' counts in the path length, as it's the drive root. So I do belive this is a 256-character limit issue. Yup... found it: "Maximum Path Length "In the Windows API, the maximum length for a path is MAX_PATH, which is defined as 260 characters. A path is structured in the following order: drive letter, colon, backslash, components separated by backslashes, and a null-terminating character, for example, the maximum path on the D drive is "D:\<256 chars>NUL". " http://msdn2.microsoft.com/en-us/library/aa365247.aspx That page also provides a possible workaround: "The Unicode versions of several functions permit a maximum path length of approximately 32,000 characters composed of components up to 255 characters in length. To specify that kind of path, use the "\\?\" prefix. " Note The maximum path of 32,000 characters is approximate, because the "\\?\" prefix can be expanded to a longer string, and the expansion applies to the total length. "For example, "\\?\D:\". To specify such a UNC path, use the "\\?\UNC\" prefix. For example, "\\?\UNC\\". These prefixes are not used as part of the path itself. They indicate that the path should be passed to the system with minimal modification, which means that you cannot use forward slashes to represent path separators, or a period to represent the current directory. Also, you cannot use the "\\?\" prefix with a relative path. Relative paths are limited to MAX_PATH characters." Good Luck! -A