# svn checkout 單一檔案 最近在整頓 Jenkins 時遇到的問題, 記錄一下~ ## 環境 > svn, version 1.13.0 (r1867053) ## 狀況 `svn checkout` 只能以資料夾為基準使用 如果直接 checkout 該檔案, 會的到這樣的錯誤訊息 ``` svn: E200007: URL 'https://mysvn.repo.com/TheProject/Table/Menu.json' refers to a file, not a directory ``` ## 解決方式 - 空抓目標檔案的那層資料夾 ``` svn checkout <url_of_big_dir> <folder_of_target> --depth empty ``` - 接著單獨更新目標檔案 ``` svn up <target> ``` ## 範例 單抓 `https://mysvn.repo.com/TheProject/Table/Menu.json` ``` D:\test>svn checkout https://mysvn.repo.com/TheProject/Table/ Table/ --depth empty D:\test>svn up Table/Menu.json ``` 這樣應該可以看到 `D:\test\Menu.json` 被抓下來囉~ ## 參考 - [Checkout one file from Subversion](https://stackoverflow.com/questions/122107/checkout-one-file-from-subversion)