Migrate jobs from views to folder

I have many jobs under view, needs to move inside folder.
I am able to move one by one but this is time consuming.
Is there any way to move all at once.

use the script console to write some groovy that loops over the jobs and moves them to your folders.