0

此代码在 ASP 页中运行。

    try 
    {
        DirectoryInfo di = Directory.CreateDirectory(destDir);
        DirectoryInfo diOut = Directory.CreateDirectory(destDir + "\\output");

        if (di.Exists) 
        {
            ErrorLog(Server.MapPath("Logs/ErrorLog"),"created or existing destDir: " + destDir );
        } 

        if (diOut.Exists) 
        {
           ErrorLog(Server.MapPath("Logs/ErrorLog"),"created or existing outputDir:" + destDir +"\\output" );
        }

    } 
    catch(Exception e)
    {
        ErrorLog(Server.MapPath("Logs/ErrorLog"),"caught error: " + e.ToString() );
    }

dst dir 的值为:

d:\foo-server\THE\jobgenerator\xmlinput\tmp_JobGenerator_09_08_201216_09_21_718374_THE

父文件夹d:\foo-server\THE\jobgenerator\xmlinput已存在。

日志输出表明 destDir 已创建,但是当我检查文件夹时,我可以看到没有创建任何内容。该站点在 IIS 上运行,配置的用户对父文件夹具有完全权限。

我不明白为什么即使没有创建文件夹, di.Exists 也会导致 true。也不会抛出异常。

谢谢您的帮助。

4

0 回答 0