Skip to content

Instantly share code, notes, and snippets.

@basilleaf
Last active December 17, 2015 14:09
Show Gist options
  • Save basilleaf/5621968 to your computer and use it in GitHub Desktop.
Save basilleaf/5621968 to your computer and use it in GitHub Desktop.
look for files locally that do not have READ permission.
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
recursively crawls directory
if any file does not have READ permission
squawks to stdout
"""
import os
directory = '/path/to/directory/'
found = False
for (path, dirs, files) in os.walk(directory, followlinks=False):
for f in files:
if not os.access(f, os.R_OK):
print('Please report to Sick Bay: ' + path + '/' + f)
found = True
if not found:
print("All files are READ ok")
print("You are in command of the Bridge.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment