def resize(folder, level=0):
	"Does the actual image scaling action" 
	          	
	tick = unichr(0x2714).encode("utf-8")
	dot= unichr(0x2726).encode("utf-8")	
	unitSegment=5     #The basic unit in the loading bar
	linesPerP=1.0/unitSegment
	
	if path.isdir(folder):						
		imageQue=[item for item in listdir(folder) if path.splitext(item.lower())[1] in extlist]		
		total=len(imageQue)		
		folderData=dot+' '+ folder.split(sep)[-1]
		done=0
		maxImageName=0 #resets to previous image name's length everytime(to clear the exact length) 
		
		for image in imageQue:
			maxImageName= max(maxImageName, len(image))
			percentage= int(float(done)/total*100)
			
			#the dynamic loading bar data 
			sys.stdout.write( "\r{indent}{fold}  [{imgno}] [{bar}] {per}%    {img}".format( 
			indent='   '+' '*level,
			fold=folderData,
			imgno=str(total)+' images',
			bar=('='*int(percentage*linesPerP)).ljust(int(100*linesPerP)),
			per=percentage, 
			img= image.ljust(maxImageName) ))			
			sys.stdout.flush()		
			
			#the resizing process
			maxImageName=len(image)
			image=path.join(folder,image)
			im=Image.open(image)
			im.thumbnail(size, Image.ANTIALIAS)
    			im.save(image, im.format)			
			done+=1
			
		
		#the completed loading bar data	
		sys.stdout.write( "\r{indent}{fold}  [{imgno}] [{alldone}] {clear}\n".format(
		indent='   '+' '*level,
		fold=folderData, 
		alldone=tick, 
		imgno=str(total)+' images',
		clear=' '*(6+maxImageName+int(100*linesPerP))  ))
		
		#attacking sub directories!				
		if getchild:
			for subfolder in listdir(folder):						
				resize(folder+sep+subfolder,level+5)
Does the actual image scaling action
recipes/Python/577189_Mass_image_resizing_progress_bar_details/recipe-577189.py