MATLAB: Image Compression Algorithm that goes on a loop.

image compression

I have a got a folder named "Newsnaps" of frames extracted from a video. Now i want to perform a image compression algorithm that will take each and every image and perform that algorithm in a loop and save the output in a folder named "Dctsnaps". Please help me with the source code. P.S. all images are grayscale images.
Related Question