本文整理汇总了Python中bleachbit.FileUtilities.globex方法的典型用法代码示例。如果您正苦于以下问题:Python FileUtilities.globex方法的具体用法?Python FileUtilities.globex怎么用?Python FileUtilities.globex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bleachbit.FileUtilities
的用法示例。
在下文中一共展示了FileUtilities.globex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rotated_logs
# 需要导入模块: from bleachbit import FileUtilities [as 别名]
# 或者: from bleachbit.FileUtilities import globex [as 别名]
def rotated_logs():
"""Yield a list of rotated (i.e., old) logs in /var/log/"""
# Ubuntu 9.04
# /var/log/dmesg.0
# /var/log/dmesg.1.gz
# Fedora 10
# /var/log/messages-20090118
globpaths = ('/var/log/*.[0-9]',
'/var/log/*/*.[0-9]',
'/var/log/*.gz',
'/var/log/*/*gz',
'/var/log/*/*.old',
'/var/log/*.old')
for globpath in globpaths:
for path in glob.iglob(globpath):
yield path
regex = '-[0-9]{8}$'
globpaths = ('/var/log/*-*', '/var/log/*/*-*')
for path in FileUtilities.globex(globpaths, regex):
whitelist_re = '^/var/log/(removed_)?(packages|scripts)'
if re.match(whitelist_re, path) is None: # for Slackware, Launchpad #367575
yield path