resize the default capacity of recycle bin for all volumes

Please use the scrip to modify the default size of Recycle-Bin for all drives.

##The default maximum storage size of a Recycle Bin location is about 5% of its space available.
def modRecycle(P_AGE):
    import _winreg
    import os
    subkey = r'Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\Volume'
    subkeys = []
    with _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, subkey, 0, _winreg.KEY_ALL_ACCESS) as key:
        i = 0
        while i >= 0:
            try:
                vskey = _winreg.EnumKey(key, i)
                subkeys.append(os.path.join(subkey, vskey))
                i += 1
            except:
                i = -1
    C = 0
    for k in subkeys:
        print 'Volume {}:'.format(C)
        with _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, k, 0, _winreg.KEY_ALL_ACCESS) as key:
            MB, T = _winreg.QueryValueEx(key, 'MaxCapacity')
            _winreg.SetValueEx(key, 'MaxCapacity', 0, _winreg.REG_DWORD, int(MB+MB*(P_AGE/100.0)))
            print 'Old Capacity: {} MB'.format(MB)
            UMB, UT = _winreg.QueryValueEx(key, 'MaxCapacity')
            if MB != UMB:
                print 'New Capacity: {} MB'.format(UMB)
            else:
                print 'Sorry, Your Volume {} has no suffient freespace!'.format(C)
            if len(subkeys)-1 != C:
                print '
'
        C += 1

def main(P_AGE):        
    INCHA = '='
    INCHA = INCHA*7
    if P_AGE > 0:
        print '{} Increased by {}% {}'.format(INCHA, P_AGE, INCHA)
        modRecycle(P_AGE)
    elif P_AGE < 0:
        print '{} Decreased by {}% {}'.format(INCHA, P_AGE*(-1), INCHA)
        modRecycle(P_AGE)
    else:
        print 'Sorry, There is no effect since you have given 0 for P_AGE variable'

if __name__ == '__main__':
    main(1) ##User can the value here to increase or decrease the Re-Cycle Bin capacity of default size.
##For example, -10 for decreasing 10% from Default size
##For example, 10 for increasing 10% to Default size

Usage:
you can change the value of arguments of main(args) function
In case, you would like to increase 10% of default size then call with main(10) from the above code
In case, you would like to decrease 10% of default size then call with main(-10) from the above code
**main(0) will take no effect

Sample output:

Script File:
​​​​​​​

resize the recycle bin default capacity.png

20170104-resize-the-recycle-bin-default-capacity.json (2.79 KB)