1. 程式人生 > >a Turtle named Thunder

a Turtle named Thunder

import io;
import fsys;
io.open();
path=io.fullpath("\"); 
//io.print("請輸入追加字串:")
var name="原始";//io.getText();
fsys.enum( path, "*.jpg",
	function(dir,filename,fullpath,findData){ 
		if(filename){
			tmp=string.sub(filename,1,-5);
			//io.print(tmp);
			newpath=dir+tmp+name+".jpg";
			//io.print(newpath);
			//execute("pause");
			fsys.rename(fullpath,newpath); 
		}
	} 
	,false/*如果此引數為false則忽略子目錄*/
);
 
io.close();