易生享

批处理删除文件夹

 

try {
FileSystem.deleteDirectory(this._nativePath);
} catch(e:Dynamic) {
switch(Sys.systemName()) {
case 'Windows':
Sys.command('rd /s/q ${this._nativePath}');
case 'Mac':
Sys.command('rm ${this._nativePath}');
}
}

this._nativePath 文件路径

public function deleteFile():Void {
try{
FileSystem.deleteFile(this._nativePath); 
}catch(e:Dynamic) {
switch(Sys.systemName()) {//平台标识
case 'Windows':
Sys.command('del/f/s/q ${this._nativePath}');
case 'Mac':
Sys.command('rm -r ${this._nativePath}');
}
}
}

posted on 2020-10-12 20:23  易生享  阅读(65)  评论(0编辑  收藏  举报

导航