# full path to dir with video # ... # get filename ending $ext = substr($filename,length($filename)-4,4);