{
  "schemaVersion": "0.11.0",
  "canonical": "https://www.pystone.net/notes/uwa-answer-directory-not-found-exception/",
  "atlas": "https://www.pystone.net/?node=uwa-answer-directory-not-found-exception#knowledge-atlas",
  "markdown": "https://www.pystone.net/notes/uwa-answer-directory-not-found-exception.md",
  "context": "https://www.pystone.net/notes/uwa-answer-directory-not-found-exception.context.json",
  "knowledgeVersion": "224c990773de.5fa8af6e39fa",
  "build": {
    "siteCommit": "224c990773de166d23a886306577dd90379529ce",
    "notesCommit": "5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a",
    "builtAt": "1970-01-01T00:00:00.000Z",
    "version": "224c990773de.5fa8af6e39fa"
  },
  "id": "note:uwa-answer-directory-not-found-exception",
  "slug": "uwa-answer-directory-not-found-exception",
  "title": "DirectoryNotFoundException: Could not find a part of the path",
  "type": "note",
  "visibility": "public",
  "idStability": "rename-stable",
  "author": {
    "name": "石心.Yong"
  },
  "publisher": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "aliases": [],
  "summary": "DirectoryNotFoundException: Could not find a part of the path",
  "contentRole": "source",
  "sourceType": "source",
  "sourceMetadata": {
    "author": "石心.Yong"
  },
  "isMoc": false,
  "mocRecognition": "none",
  "generated": false,
  "attribution": "external_source",
  "domain": "10-计算机、信息技术与工程",
  "tags": [],
  "mocs": [],
  "contentHash": "4a8ed798cd717ac6f646bd04c784daf1cd3fad1375369911bcf2f22b81efe130",
  "assets": [
    {
      "reference": "assets/60949a1f6bb31032f9791509/01.png",
      "url": "/media/b5ee8c3ccd0b94282228.png",
      "mediaType": "image/png",
      "contentHash": "b5ee8c3ccd0b94282228a142161ecd3276d92524129260150c6ca2ece3215771",
      "byteLength": 7062,
      "width": 334,
      "height": 87
    },
    {
      "reference": "assets/60949a1f6bb31032f9791509/02.png",
      "url": "/media/8c3a0d5111a8254e57bd.png",
      "mediaType": "image/png",
      "contentHash": "8c3a0d5111a8254e57bd6eebf49c509ce99204a068719b1a6e352cafa8bd8185",
      "byteLength": 110879,
      "width": 434,
      "height": 738
    }
  ],
  "headings": [
    {
      "depth": 1,
      "text": "DirectoryNotFoundException: Could not find a part of the path",
      "anchor": "directorynotfoundexception-could-not-find-a-part-of-the-path",
      "citation": "https://www.pystone.net/notes/uwa-answer-directory-not-found-exception/#directorynotfoundexception-could-not-find-a-part-of-the-path"
    },
    {
      "depth": 2,
      "text": "问题",
      "anchor": "问题",
      "citation": "https://www.pystone.net/notes/uwa-answer-directory-not-found-exception/#%E9%97%AE%E9%A2%98"
    },
    {
      "depth": 2,
      "text": "我的回答",
      "anchor": "我的回答",
      "citation": "https://www.pystone.net/notes/uwa-answer-directory-not-found-exception/#%E6%88%91%E7%9A%84%E5%9B%9E%E7%AD%94"
    },
    {
      "depth": 2,
      "text": "来源与关系",
      "anchor": "来源与关系",
      "citation": "https://www.pystone.net/notes/uwa-answer-directory-not-found-exception/#%E6%9D%A5%E6%BA%90%E4%B8%8E%E5%85%B3%E7%B3%BB"
    }
  ],
  "claims": [],
  "outgoing": [
    {
      "id": "note:my-uwa-answers",
      "title": "我的 UWA 问答",
      "url": "https://www.pystone.net/notes/my-uwa-answers/",
      "atlas": "https://www.pystone.net/?node=my-uwa-answers#knowledge-atlas",
      "label": "我的 UWA 问答",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "上位集合：我的 UWA 问答",
      "citation": "https://www.pystone.net/notes/uwa-answer-directory-not-found-exception/#%E6%9D%A5%E6%BA%90%E4%B8%8E%E5%85%B3%E7%B3%BB"
    }
  ],
  "incoming": [
    {
      "id": "note:my-uwa-answers",
      "title": "我的 UWA 问答",
      "url": "https://www.pystone.net/notes/my-uwa-answers/",
      "atlas": "https://www.pystone.net/?node=my-uwa-answers#knowledge-atlas",
      "label": "我的 UWA 问答",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "2021-05-07：DirectoryNotFoundException: Could not find a part of the path（资源管理、项目管理）",
      "citation": "https://www.pystone.net/notes/my-uwa-answers/#2021"
    },
    {
      "id": "note:game-graphics-and-runtime",
      "title": "游戏图形与运行时",
      "url": "https://www.pystone.net/notes/game-graphics-and-runtime/",
      "atlas": "https://www.pystone.net/?node=game-graphics-and-runtime#knowledge-atlas",
      "label": "游戏图形与运行时",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "我的UWA问答中的“2021-05-07 - DirectoryNotFoundException- Could not find a part of the path”导航项",
      "citation": "https://www.pystone.net/notes/game-graphics-and-runtime/#%E6%88%91%E7%9A%84uwa%E9%97%AE%E7%AD%94"
    }
  ],
  "contentMarkdown": "# DirectoryNotFoundException: Could not find a part of the path\n\n> [!note] 我的 UWA 问答\n> 本文收录我在 UWA 问答发表的公开回答。问题内容归原提问者；回答保留当时语境，技术结论可能受 Unity 版本、平台和项目条件限制。\n\n## 问题\n\nUnity2019和2020都有遇到，只是执行文件夹删除再创建，就会报这个错误，大概10次会报1、2次。打log看了是Delete这行报的错，请教大神帮忙解决。\n\n![image.png](assets/60949a1f6bb31032f9791509/01.png)\n\n ![image.png](assets/60949a1f6bb31032f9791509/02.png)\n column1\n column2\n column3\n\n content1\n content2\n content3\n\n- 提问者：路人甲\n- 提问时间：2021-05-07 17:38:39\n\n## 我的回答\n\n路径不存在，可能就确实是路径不存在。对Unity Assets下的文件夹，Delete(dir, true)之后，再CreateDirectory大概率是创建失败的。对于文件夹FolderA，Delete会把对应的 FolderA .meta 文件删掉，紧接着，在C#程序创建一个FolderA之后，Unity发现 FolderA .meta 文件被删掉了，会认为你执行了删除FolderA的操作，进而Unity会把刚刚创建的 FolderA再删掉。\n\n可以试一下，对于空文件夹，手动删掉meta文件，在Unity中Refresh之后，Unity会把对应的文件夹删掉。\n\n解决方法如楼上所说，清理文件夹。但是还需要加一个逻辑：保留文件夹的.meta文件。\n\n- 回答时间：2021-05-07 19:25:27\n- 最后更新：2021-05-07 19:25:27\n- 采纳状态：未采纳\n\n## 来源与关系\n\n- 上位集合：[[10-计算机、信息技术与工程/05-游戏图形与运行时/我的UWA问答/我的UWA问答|我的 UWA 问答]]\n- UWA 标签：资源管理、项目管理\n- 原始问题：[DirectoryNotFoundException: Could not find a part of the path](https://answer.uwa4d.com/question/60949a1f6bb31032f9791509)\n- 源页最后更新：2021-05-07 19:25:27\n"
}
