Files by size

I am new to Unix and need help. I have several files of different sizes Example: 1 GB , 2GB , 500 mb ,200mb and even small sizes. What I want is I want to pick files and sum of the combined file size should be less than 3 Gb and move them to a different directory. when I do ls -ltr I want to pcik files of size 3 GB (files sizes combined it could be 2 files or 3 files or 30 files but should be less than 3 GB ). every time the script should pick up files less than 3 GB . For any reason there are only 5 files and the total size is less than 3 Gb then all those files should be picked and moved as well. We are in AIX unix Please let me know if you need more information. Thank you in advance for your help.

This is a duplicate of the thread: Files by size
Please continue any discussion on this topic there.

This thread is closed.

1 Like