Long File path Exception:The system cannot find the path specified

Vino.B via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 23 06:04:28 PDT 2017


On Wednesday, 23 August 2017 at 12:12:47 UTC, Moritz Maxeiner 
wrote:
> On Wednesday, 23 August 2017 at 12:01:20 UTC, Vino.B wrote:
>> On Wednesday, 23 August 2017 at 11:29:07 UTC, Moritz Maxeiner 
>> wrote:
>>>
>>> On which line do you get the Exception? Does it happen with 
>>> shorter paths, as well?
>>> Assuming it happens with all paths: Just to be sure, is each 
>>> of those backslashes actually encoded as a backslash? If you 
>>> specified the path in the D source like `path = 
>>> "N:\PROD_TEAM..."`, then it won't be, because backslash is an 
>>> escape character (you would need to write `path = 
>>> "N:\\PROD_TEAM..."`, or better yet path = "N:/PROD_TEAM..."`).
>>
>>   The above program scan for files/directories under the main 
>> folder N:\PROD_TEAM\ and reports the size of each of the sub 
>> folders eg: "TST_BACKUP", under the main folder 
>> "N:\PROD_TEAM\" there are more than 9000+ files/directories, 
>> eg: (N:\PROD_TEAM\TST_BACKUP,N:\PROD_TEAM\PRD_BACKUP\....)  
>> and the above program will output the size of the sub folders 
>> "TST_BACKUP,PRD_BACKUP",  there is no issue is the path is 
>> shorter, the issue arises only when the path is bigger, eg the 
>> program prints the size of the sub folder PRD_BACKUP but when 
>> it tries to scan the sub folder TST_BACKUP the issue arises 
>> and the program terminates with the exception "The system 
>> cannot find the path specified", hence it not not be possible 
>> to provide the path explicitly, so can you help me on this.
>
> While that is good to know, you still haven't answered my 
> initial question:
>
>>> On which line do you get the Exception?
>
> If your program terminates because of an uncaught exception (as 
> you stated), then you should've received a stack trace 
> containing the line number on which the exception was thrown 
> (remember to compile with debug info).
> You should also consider providing a compilable, minimal 
> example (with test data) that can be used to reproduce the 
> issue.

The line it complains is std.file.FileException at std\file.d(3713): 
even after enabling debug it points to the same

Output:
D:\DScript>rdmd -debug Test.d -r  dryrun

std.file.FileException at std\file.d(3713): 
N:\PROD_TEAM\TST_BACKUP\abcyf0\TST_BATS\j2ee_backup\cluster\states0\apps\bat.com\tc~bat~agent~application~e2emai~std~collectors\servlet_jsp\tc~bat~agent~application~e2emai~std~collectors\root\WEB-INF\entities\DataCollectionPushFileContentScannerTypeBuilder: The system cannot find the path specified.
----------------
0x00431A56
0x00429801

From,
Vino.B


More information about the Digitalmars-d-learn mailing list