chenpeilei2003 发表于 2013-1-15 02:20:15

用lua批量改名

function rename(dirpath,func)    os.execute('dir ' .. dirpath .. ' /b/a -d > temp.txt')    io.input("temp.txt")    local dirname = ""    local files = {}    for line in io.lines() do ifstring.find(line,'.bmp') thentable.insert(files,line) end    end    for k,v in pairs(files) doname=string.sub(v,1,#v-4)..'_swap'cmd = 'ren '..dirpath..v..' '..name..'.bmp'os.execute(cmd)    endendrename('C:\\Users\\xx\\Desktop\\bmp\\')

用lua批量改名, 所有bmp文件名加后缀 _swap
页: [1]
查看完整版本: 用lua批量改名