Find Files By Size

Please use the script to find files that has more than or equal to the specific size

Note: file size ‘limit’ should be in KB

def findFilesBySizeKB(recPath, limit):
    import os
    ls = []
    if os.path.exists(recPath):
        for root, dirs, files in os.walk(recPath):
            for fname in files:
                fsize = os.path.getsize(os.path.join(root, fname))/1024
                if fsize >= limit:
                    ls.append(fname+' '+str(fsize)+'KB')
    return ls


if __name__=='__main__':
    c = 0
    print 'File Name: '
    for i in findFilesBySizeKB('C:\Users\Andrews\Downloads', 6000):
        print i
        c += 1
    print '
'
    print 'Number of Files: ',c

Sample Output:

Find Files By Size.PNG