douxian6008 2015-10-02 13:29
浏览 311
已采纳

FileInfo.IsDir()未检测到目录

I have some code that walks through a directory to get the files, to operate on them and it uses IsDir() to skip directories. However, a directory isn't properly being detected:

err = filepath.Walk(dir, func(path string, f os.FileInfo, err error) error {
    if !f.IsDir() {
        fileList = append(fileList, path)
    }
    return nil
})

Error:

Put app/javascripts: read public/app/javascripts: is a directory

I'm on OSX. Here's the directory listing:

drwxr-xr-x@   6 me  staff     204 Sep 25 11:28 javascripts

Is there a better way to detect directories?

  • 写回答

2条回答 默认 最新

  • douzhuo3233 2015-10-02 14:14
    关注

    I was looking at the wrong dir (confusing names). It was a symlink, which makes sense.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里