用lua批量更名

用lua批量改名function rename(dirpath,func)os.execute(dir .. dirpath .. /b/a -d temp.txt)io.

用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 if  string.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