Automatic folding and stacking machinery for large and small pieces