Last active
October 5, 2017 23:29
-
-
Save fwarren/7d01a7a98570a917d4a6219bc2fb4778 to your computer and use it in GitHub Desktop.
Find all files in filetree that have null signatures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
# Import the os module, for the os.walk function | |
import os | |
# Set the directory you want to start from | |
rootDir = '/cygdrive/d/Tank/Shares' | |
for dirName, subdirList, fileList in os.walk(rootDir): | |
for fname in fileList: | |
with open('%s/%s' % (dirName,fname), "rb") as f: | |
if f.read(8) == '\x00\x00\x00\x00\x00\x00\x00\x00': | |
mytime = datetime.datetime.fromtimestamp(os.path.getmtime('%s/%s' % (dirName,fname))).strftime('%Y-%m-%d:%H:%M') | |
print('%s\t%s/%s' % (mytime,dirName,fname)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment