I'm creating a timelapse video by splitting a video into individual images, using G'MIC via the command line to average every 7 frames, then output the results to new images which will result in the frames for the timelapse (this way I get noise free video that looks great). As you can imagine I have a lot of frames - several thousand individual images in a directory, named sequentially (image1.tiff, image2.tiff, etc.). I found a script that works perfectly for moving the files - once...
k=1; find source/ -type f | while read file; do [[ k++ -le 7 ]] && mv "$file" target/ done
What I need now is to make this script
- repeat itself until all the files are moved and
- create sequentially numbered target directories (1, 2, 3, etc.) as it goes so I end up with several hundred directories each with 7 images inside.
Just to clarify, directory 1 should contain images 1-7, directory 2 should contain images 8-14, etc.
Any help is greatly appreciated, I'm pretty much stuck with this one.