#!/usr/bin/python
#
#NAME:
#  list_folders_without_folderjpg.py
#
#PURPOSE:
#  To go through all of the files in a directory (recursively)
#  and list the ones that do not have a thumbnail jpeg called 
#  folder.jpg (or any combintation of upper/lower cases)
#
import os
import pdb
rootdir = '/Volumes/Elements/Mystery/'

for root, directories, filenames in os.walk(rootdir):

  #Scan through the subdirectories of the rootdir 
  for directory in directories:

    #Declare a variable to detect presence of thumbnail jpg
    FoundJPG = 0

    #Now go through each directory and look for the jpg
    for root2, directories2, filenames2 in os.walk(os.path.join(root,directory)):
      for filename2 in filenames2:
        if (filename2 == 'folder.jpg') or (filename2 == 'FOLDER.jpg') or (filename2 == 'folder.JPG') or (filename2 == 'FOLDER.JPG') or (filename2 == 'Folder.jpg') or (filename2 == 'Folder.JPG'):
          FoundJPG = 1
    
    #No jpg was found 
    if (FoundJPG == 0):
      print os.path.join(root, directory)
