# script used to filter a BEAST output folder
# 1) removes any log files that are incomplete 
# 2) removes any other tree and operator files

import sys
import os
from glob import glob 
from shutil import *
import subprocess

inFolder = sys.argv[1]

if not inFolder.endswith("/"):
    inFolder += "/"

if not os.path.isdir(inFolder):
    print("this is not a proper directory")
    exit()

runFolders = glob(inFolder+"*")

for folder in runFolders:

    finished = "/home/jpalmer/PycharmProjects/hiv-withinhost/8_1_Hfinished/"

    #if not os.path.isdir(unfinished):
        #os.mkdir(unfinished)

    files = glob(folder + "/*")

    if len(files) != 0:
        for f in files: 
            fileSize = subprocess.check_output(["stat", '--printf="%s"', f])
            fileSize = fileSize.strip('"')
            filename = os.path.basename(f)

            if int(fileSize) > 0:
                copyfile(f, finished+filename)


        

f511a9e2a13c9a81f1bb205f1dd69bf831cd19c6
<mask token>

<mask token>
if not inFolder.endswith('/'):
    inFolder += '/'
if not os.path.isdir(inFolder):
    print('this is not a proper directory')
    exit()
<mask token>
for folder in runFolders:
    finished = '/home/jpalmer/PycharmProjects/hiv-withinhost/8_1_Hfinished/'
    files = glob(folder + '/*')
    if len(files) != 0:
        for f in files:
            fileSize = subprocess.check_output(['stat', '--printf="%s"', f])
            fileSize = fileSize.strip('"')
            filename = os.path.basename(f)
            if int(fileSize) > 0:
                copyfile(f, finished + filename)

<mask token>
inFolder = sys.argv[1]
if not inFolder.endswith('/'):
    inFolder += '/'
if not os.path.isdir(inFolder):
    print('this is not a proper directory')
    exit()
runFolders = glob(inFolder + '*')
for folder in runFolders:
    finished = '/home/jpalmer/PycharmProjects/hiv-withinhost/8_1_Hfinished/'
    files = glob(folder + '/*')
    if len(files) != 0:
        for f in files:
            fileSize = subprocess.check_output(['stat', '--printf="%s"', f])
            fileSize = fileSize.strip('"')
            filename = os.path.basename(f)
            if int(fileSize) > 0:
                copyfile(f, finished + filename)

import sys
import os
from glob import glob
from shutil import *
import subprocess
inFolder = sys.argv[1]
if not inFolder.endswith('/'):
    inFolder += '/'
if not os.path.isdir(inFolder):
    print('this is not a proper directory')
    exit()
runFolders = glob(inFolder + '*')
for folder in runFolders:
    finished = '/home/jpalmer/PycharmProjects/hiv-withinhost/8_1_Hfinished/'
    files = glob(folder + '/*')
    if len(files) != 0:
        for f in files:
            fileSize = subprocess.check_output(['stat', '--printf="%s"', f])
            fileSize = fileSize.strip('"')
            filename = os.path.basename(f)
            if int(fileSize) > 0:
                copyfile(f, finished + filename)

# script used to filter a BEAST output folder
# 1) removes any log files that are incomplete 
# 2) removes any other tree and operator files

import sys
import os
from glob import glob 
from shutil import *
import subprocess

inFolder = sys.argv[1]

if not inFolder.endswith("/"):
    inFolder += "/"

if not os.path.isdir(inFolder):
    print("this is not a proper directory")
    exit()

runFolders = glob(inFolder+"*")

for folder in runFolders:

    finished = "/home/jpalmer/PycharmProjects/hiv-withinhost/8_1_Hfinished/"

    #if not os.path.isdir(unfinished):
        #os.mkdir(unfinished)

    files = glob(folder + "/*")

    if len(files) != 0:
        for f in files: 
            fileSize = subprocess.check_output(["stat", '--printf="%s"', f])
            fileSize = fileSize.strip('"')
            filename = os.path.basename(f)

            if int(fileSize) > 0:
                copyfile(f, finished+filename)


        
