diff --git a/exec/tempxfer.js b/exec/tempxfer.js index 42e9d26855557748a81e8fb70ffdea59f64afbbc..bf15643482b719b3638cd4f1db456e8d8e58ab89 100755 --- a/exec/tempxfer.js +++ b/exec/tempxfer.js @@ -13,6 +13,8 @@ if(user.security.restrictions & UFLAG_D) { function delfiles(dir, spec) { + if(typeof js.global.rmfiles == "function") + return js.global.rmfiles(dir, spec); var count = 0; var list = directory(dir + spec); for(var i = 0; i < list.length; i++) { @@ -47,7 +49,12 @@ function checkspace() function checktemp() { - if(!directory(system.temp_dir + "*").length) { + var list = directory(system.temp_dir + "*"); + var files = 0; + for(var i = 0; i < list.length; i++) + if(!file_isdir(list[i])) + files++; + if(files < 1) { writeln("\r\nNo files in temp directory."); writeln("Use 'E' to extract from file or Create File List with 'N' or 'F' commands."); return false; @@ -131,6 +138,8 @@ while(bbs.online && !console.aborted) { for(var i = 0; i < list.length; i++) longest = Math.max(longest, file_getname(list[i]).length); for(var i = 0; i < list.length && !console.aborted; i++) { + if(file_isdir(list[i])) + continue; var size = file_size(list[i]); writeln(format(file_fmt ,longest @@ -255,3 +264,6 @@ while(bbs.online && !console.aborted) { break menu; } } + +// Clear out the temp directory when done +delfiles(system.temp_dir, "*");