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 05:01:20 PDT 2017


On Wednesday, 23 August 2017 at 11:29:07 UTC, Moritz Maxeiner 
wrote:
> On Wednesday, 23 August 2017 at 05:06:50 UTC, Vino.B wrote:
>> Hi All,
>>
>>   When i run the below code in windows i am getting "The 
>> system cannot find the path specified" even though the path 
>> exist , the length of the path is 516 as below, request your 
>> help.
>>
>> Path :
>> 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
>>
>> Program:
>> [...]
>
> 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..."`).

Hi,

   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.

From,
Vino.B


More information about the Digitalmars-d-learn mailing list