if you really want to go from the polygon to the file thats attached.. the way is a little longer ;]
CODE
{
// get faces in selection
string $faces[] = polyListComponentConversion -tf;
// get shapes from faces
string $shapes[] = stringArrayRemoveDuplicates(listRelatives -p $faces);
// browse shapes for shadingGroups
string $shadingGroups[];
for ($shape in $shapes)
{
$shadingGroups = stringArrayCatenate($shadingGroups,listSets -type 1 -object ($shape + ".f[*]"));
}
$shadingGroups = stringArrayRemoveDuplicates($shadingGroups);
// browse shadingGroups for shaders
string $shaders[];
for ($shadingGroup in $shadingGroups)
{
$shaders = stringArrayCatenate($shaders,ls("-materials",listConnections $shadingGroup));
}
// browse shaders for filenodes
string $fileNodes[];
for ($shader in $shaders)
{
$fileNodes = stringArrayCatenate($fileNodes,listConnections -type file $shader);
}
// browse filenodes for filePaths
string $paths[];
for ($fileNode in $fileNodes)
{
$thisPath = getAttr($fileNode + ".fileTextureName");
if ($thisPath != "")
$paths[size($paths)] = $thisPath;
}
// check if paths are ok
for ($path in $paths)
{
if (file -q -ex $path)
print ("\"" + $path + "\" exists! \n");
else
print ("\"" + $path + "\" does not exist! \n");
}
}
polygon > shape > shadingEngine > material > filenode > fileTextureName