unix/linux隐藏文件确实一直有这个bug

>>> import os
>>> dotFiles = [filename for filename in os.listdir('.') if filename.startswith('.') and len(filename) > 1]
>>> print len(dotFiles)
23
>>> print dotFiles
['.subversion', '.xsession-errors', '.bashrc', '.local', '.gvfs', '.synaptic', '.gnome2_private', '.bash_history', '.viminfo', '.gconf', '.pulse-cookie', '.config', '.gconfd', '.ICEauthority', '.pulse', '.nautilus', '.vimrc', '.cache', '.dbus', '.profile', '.gtk-bookmarks', '.mozilla', '.gnome2']
>>>

.和..没有,但是仍然能够有这些其他的以.开头的文件名

unix/linux隐藏文件确实是有这个bug
应该如此:if (name[0] == '.') continue;
却变为如此:if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) continue;

http://www.douban.com/note/252925677/

posted @ 2012-12-16 20:14  yarpee  阅读(248)  评论(0编辑  收藏  举报