ext=".log"
location_search="C:\\Users\\omy"
from subprocess import Popen,PIPE
import os
import time
start=time.time()
def convert_bytes(size, unit=None):
    if unit == "KB":
        return ('File size\t: ' + str(round(size / 1024, 3)) + ' Kilobytes')
    elif unit == "MB":
        return ('File size\t: ' + str(round(size / (1024 * 1024), 3)) + ' Megabytes')
    elif unit == "GB":
        return ('File size\t: ' + str(round(size / (1024 * 1024 * 1024), 3)) + ' Gigabytes')
    else:
        return ('File size\t: ' + str(size) + ' bytes')
os.chdir(location_search)
#print os.getcwd()
cmd="dir /b *%s /s"%ext
#print cmd
file_links=os.popen(cmd).read()
if file_links:
    files=file_links.split("\n")[:-1]
    for i in files:
        print("File Name\t: {}".format(i.split("\\")[-1]))
        print("Location\t: {}".format("\\".join(j for j in i.split("\\")[:-1])))
        print("Access time\t: {}".format(time.ctime(os.path.getatime(i))))
        print('Modified time\t: {}'.format(time.ctime(os.path.getmtime(i))))
        k=convert_bytes(os.path.getsize(i))
        print(k)
        print('\n') 
else:
    print("File Not Found")
end=time.time()
print("Execution Time: {} ".format(end-start))