I have a bunch of video files which I would like to segregate based on file size I have decided.
Example:
Folder BB has 15 files of various file size.
I have sub folder set as:
less than 100 MB -- folder A
100 MB to 500 MB -- folder B
more than 500 MB -- folder C
So instead of manually doing it can it be done via Bash or a script.
I have a general idea that find
command and a proper if else would work, but have no idea how to script it.
Anyway, a general programming frame would be:
float _size=[file_size]; // Reads the file size
if(_size<100) // File size is less than 100 MB
{ exec mv [file] /A/* ; // Move to folder A }
else if(_size>500) // File size is greater than 500 MB
{ exec mv [file] /C/* ; // Move to folder C }
else if((_size<=500)||(_size>=100)) //file size is between 100 to 500
{ exec mv [file] /B/* ; // Move to folder C}
else
{print("file error");}
So I hope it is easy to do. The above was just a general idea I would have done.