我有一个遍历目录并生成 md5sums 的 Python 程序。在一个文件上它卡住了。运行ls -lA
我发现它有属性prw-------
。一些谷歌搜索后我发现这表示管道。
如何检查我的遍历中的管道?我只想跳过这个文件。
我的遍历代码是:
for dirpath, _, files in walk(folder):
for fname in files:
print join(dirpath, fname)
if not islink(join(dirpath, fname)):
# do something with the file, here I pass it to myClass.
myClass.addFile(dirpath, fname)