如何防止Python的os.walk跨挂载点移动? [英] How do I prevent Python's os.walk from walking across mount points?

查看:59
本文介绍了如何防止Python的os.walk跨挂载点移动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Unix中,所有磁盘都作为主文件系统中的路径公开,因此 os.walk('/')会遍历,例如,/media/cdrom 以及主硬盘,这对于某些应用程序是不希望的.

In Unix all disks are exposed as paths in the main filesystem, so os.walk('/') would traverse, for example, /media/cdrom as well as the primary hard disk, and that is undesirable for some applications.

如何获取驻留在单个设备上的 os.walk ?

How do I get an os.walk that stays on a single device?

相关:

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆