import pickle
import os
List = []
for fileName in os.listdir ( '/test/' ):
Directory = fileName
List.append(Directory)
print Directory
List.sort()
print List
ListLength = len(List) - 1
x=0
y=5
while y <> 2:
while x < ListLength:
b = List[x]
c = List[x + 1]
backward1 = List[x - 1]
d = b[:y]
e = c[:y]
backward2 = backward1[:y]
f = str(d)
g = str(e)
backward3 = str(backward2)
if f==g:
print "Yes, truncated variables:",f,"and",g
print "Match",b,"and",c
else:
print "No"
print b,"and",c,"no match"
print "truncated variables:",f,"and",g
if f==backward3:
print "But the last two matched"
print "truncated variables:",f,"and",g
print b,"and",backward1
else:
print "The last two did not match"
print y
x = x + 1
y = y - 1
#<aum> lines 3-8 could shorten to:
#<aum> List = os.listdir("/test")
#<aum> List.sort()