import os
import re
import sys
import glob
import datetime
from maya import cmds, mel

def editShaderValue(attributes=[]):
    # 
    # Input your target attribute.
    # 
    # attributes = [
    #     'diffuse',
    #     'colorR',
    # ]
    
    anisotropicList = cmds.ls(typ='anisotropic') or []
    for asl in anisotropicList:
        print '[ %s ]' % asl
        for attr in attributes:
            if cmds.attributeQuery(attr, n=asl, ex=True):
                cmds.setAttr('%s.%s' % (asl, attr), .0)
                print '\t%s >>> .0' % attr

def getLatestFile(dirPath='F:/', fileFilter='', fileExt='.mb'):
    if not os.path.isdir(dirPath):
        return ''
    dirPath = dirPath.replace(os.sep, '/')
    searchPath = '%s%s*%s' % (dirPath, fileFilter, fileExt)
    files = glob.glob(searchPath)
    if not files:
        return []
    latestFile = max(files, key=os.path.getctime)
    latestFile = latestFile.replace(os.sep, '/')
    return latestFile

def doIt(
    rootPath = r'F:\aaa\bbb\ccc',
    subFolderPath=r'hoge\scenes',
    searchFileType='.mb',
    editAttributes=['diffuse', 'colorR',],
    saveFileType='.ma'
):
    # 
    # Input your root folder.
    # 
    rootPath = rootPath

    # Get target folder.
    elements = glob.glob('%s/*' % rootPath)

    # 
    # If you have subfolders, edit here.
    # 
    subFolderPath = subFolderPath

    # Get the date of today.
    today = datetime.datetime.today().strftime('%Y%m%d%H%M%S')

    for element in elements:
        targetFolderPath = '/'.join([element, subFolderPath])
        targetFolderPath = '%s/' % targetFolderPath

        # Get the latest file.
        latestFile = getLatestFile(
            dirPath=targetFolderPath,
            fileFilter='',
            fileExt=searchFileType
        )
        
        # File open.
        cmds.file(
            latestFile,
            f=True,
            o=True
        )

        # Edit the material.
        editShaderValue(attributes=editAttributes)
        
        # File save.
        basename = os.path.basename(latestFile)
        temps = basename.split('.')
        extension = temps[-1]
        fileName = basename.replace('.%s' % extension, '')
        if re.search('editAMat', fileName):
            fileName = fileName.split('_editAMat')[0]
        newName = '_'.join([fileName, 'editAMat%s' % today])
        newFilePath = '%s%s.%s' % (targetFolderPath, newName, extension)
        
        cmds.file(rename=newFilePath)
        fileType = 'mayaAscii'
        if saveFileType == '.mb':
            fileType = 'mayaBinary'
        cmds.file(save=True, type=fileType)

#
# Edit.
#
rootPath       = r'D:\samurai\project\tempProjectA'
subFolderPath  = r'hoge\scenes'
editAttributes = [
    'diffuse',
    'colorR',
]
searchFileType = '.mb'
saveFileType   = '.ma'

# Doit.
doIt(
    rootPath = rootPath,
    subFolderPath=subFolderPath,
    searchFileType=searchFileType,
    editAttributes=editAttributes,
    saveFileType='.ma'
)

@@ -248,51 +248,36 @@
     
-anisotropicList = cmds.ls(typ='anisotropic'
+materials = cmds.ls(mat=True
 ) or
@@ -292,30 +292,24 @@
 for 
-asl
+mat
  in 
-anisotropicList
+materials
 :%0A  
@@ -331,19 +331,19 @@
 %25s %5D' %25 
-asl
+mat
 %0A       
@@ -410,19 +410,19 @@
 attr, n=
-asl
+mat
 , ex=Tru
@@ -469,11 +469,11 @@
  %25 (
-asl
+mat
 , at
@@ -2589,18 +2589,19 @@
 )%0A%0A#
+ 
 %0A# Edit
-.
 %0A#
+ 
 %0Aroo
@@ -2620,18 +2620,17 @@
 = r'
-D:%5Csamurai
+F:%5Cohmomo
 %5Cpro
@@ -2708,29 +2708,26 @@
    '
-diffuse',%0A    'colorR
+specularAnisotropy
 ',%0A%5D
@@ -2780,12 +2780,29 @@
 %0A%0A# 
-Doit
+Batch mode. Auto save
 .%0Ado
@@ -2958,8 +2958,114 @@
 '.ma'%0A)%0A
+%0A%0A#%0A# Single Command.%0A#%0Aattributes = %5B%0A    'specularAnisotropy',%0A%5D%0AeditShaderValue(attributes=attributes)%0A

Update shineSongRiceField.py