Skip to content

Instantly share code, notes, and snippets.

@tfcollins
Last active August 29, 2015 13:57
Show Gist options
  • Save tfcollins/9776083 to your computer and use it in GitHub Desktop.
Save tfcollins/9776083 to your computer and use it in GitHub Desktop.
import commands
import glob
import os
difflines = 12
# Get all .m files
target_dir = 'tmp' #No trailing slash
command = 'rm -rf '+target_dir
os.system(command)
command = 'mkdir '+target_dir
os.system(command)
command = 'find . -iname "*.m" -exec cp "{}" '+target_dir+ ' \;'
os.system(command)
files = glob.glob( target_dir+'/*m' )
files2 = files
for filename1 in files:
for filename2 in files2:
command = 'diff -y --suppress-common-lines '+filename1+' '+filename2+" | grep '^' | wc -l"
status, output = commands.getstatusoutput( command )
if (int(output) < difflines) and (filename1 is not filename2):
print '## Close files ##'
print 'Score: '+str(int(output))
print filename1
print filename2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment