g00001
2021-05-11 23:32:56 +08:00
可以自己写一个,下面是我用 aardio 写的:
import fsys;
import fsys.dirWatcher;
import win.ui;
/*DSG{{*/
var winform = win.form(text="临视指定文件并移动目录")
winform.add(
editChange={cls="edit";left=15;top=17;right=740;bottom=449;db=1;dl=1;dr=1;dt=1;edge=1;hscroll=1;multiline=1;vscroll=1;z=1}
)
/*}}*/
var targetDir = "d:\dst" //目标目录
var watchDir = "d:\src" //监视的目录
var watchRule = ".+\.zip" //监视规则
var watcher = fsys.dirWatcher.thread(
function(filePath,action,actionText){
if(action==1/*_FILE_ACTION_ADDED*/
|| action = 5/*_FILE_ACTION_RENAMED_NEW_NAME*/){
var fileName = io.splitpath(filePath).file
if(fileName ? string.match(fileName,watchRule)){
var path = io.joinpath(watchDir,filePath);
fsys.move(path,io.joinpath(targetDir,filePath));
winform.editChange.print("已移动",filePath);
}
}
}, watchDir);
//退出停止监视文件
winform.onDestroy = function(){
if(watcher) watcher.close();
}
winform.show()
win.loopMessage();