def run_from_direcotry(path):
    fs = filetools.find_files(path, ext='.png')
    files = [path + '/' + f for f in fs]
    for d in range(1, len(files)):
        v = files[d]
        print(v)
        run_from_image_path(v)
examples = []

save_dir = base_dir + '../../'
img_ext = '.JPG'
img_ext2 = '.jpg'

plant_test = []
plant_train = []
for x in range(len(plants)):
    disease_test = []
    disease_train = []
    for y in range(len(diseases[x])):
        # print("%s %s"%(plants[x],diseases[x][y]))
        # Find the files that conform to given plant cat X and disease cat Y
        file_list = filetools.find_files(base_dir + '/' + director[x][y] + '/',
                                         img_ext)
        file_list = file_list + filetools.find_files(
            base_dir + '/' + director[x][y] + '/', img_ext2)
        # Create image / label tuples
        img_lab_l = [(base_dir + '/' + director[x][y] + '/' + f, x, y)
                     for f in file_list]
        # print("%s %s has %d examples..."%(plants[x],diseases[x][y],len(file_list)))
        # Determine the number of testing examples
        test_len = len(file_list) * 3 // 10
        # Create a test list
        test_list = img_lab_l[:test_len]
        # Create a train list starting from the end of the test list
        train_list = img_lab_l[test_len:]
        # Append these lists to the running plant list.
        print("%s & %s & %d & %d" %
              (plants[x], diseases[x][y], len(test_list), len(train_list)))
# Image Mover

# This is a simple script to move files into an image directory.
import os
import time
import filetools as ft

directory = 'F:/Greenthumb_Vision/network_log/tensorlogs/26_Feb_2018_21_00_TEST/Images/'

files = ft.find_files(directory, ext='.png')
x = 0
num = len(files)
for f in files:
    x += 1
    # os.rename(directory + f, directory + 'Images/' + f)
    os.remove(directory + f)
    # time.sleep(.005)
    if x % 1000 == 0:
        print("%d / %d, %.2f%%" % (x, num, (x / num)))