from os import listdir
from os.path import isfile, join
import os

directory = "/var/www/arenofamily.com/public_html/football/images/icons/"

onlyfiles = [ f for f in listdir( directory ) if isfile( join( directory, f ) ) ]
for file in onlyfiles:
	newName = file.split( "%2F" )
	if( len( newName ) < 5 ):
		continue
	newName = newName[5].split( '&' )[0]
	systemCommand = 'mv "' + file + '" ' + newName
	os.system( systemCommand )
	print systemCommand			    


