function RenameFile(OldName,NewName)
local file = io.popen("dir C:\\Users\\Robot\\Desktop /b/s")
local data = file:read("*all")
_,_,line = string.find(data,"([^\n\r]+.PAR)")
print("line = ",line)
local str = "C:\\Users\\Robot\\Desktop\\"..OldName..".PAR" --需要两个\\,只有一个\时,\会被丢弃
print(str)
if line == str then
os.rename(line , string.format("C:\\Users\\Robot\\Desktop\\%s.PAR", NewName))
end
end
RenameFile("PARAMDATA2","PARAMDATA3") --重命名前,重命名后