Skip to content
Snippets Groups Projects
Commit 8512b601 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Add option (-delete) to delete the list file after import

Like the -d option for ADDFILES.

For Al (TRMB)
parent 46e1e752
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@ if(argv.indexOf("-help") >= 0 || argv.indexOf("-?") >= 0) {
print("-fdate[=fmt] include file's date in description");
print("-adate[=fmt] include newest archived file date in description");
print(" (fmt = optional strftime date/time format string)");
print("-delete delete list after import");
print("-v increase verbosity of output");
print("-debug enable debug output");
exit(0);
......@@ -160,8 +161,9 @@ for(var d = 0; d < dir_list.length; d++) {
}
var file_list = [];
var listpath;
if(listfile) {
var listpath = file_getcase(dir.path + listfile) || file_getcase(listfile);
listpath = file_getcase(dir.path + listfile) || file_getcase(listfile);
var f = new File(listpath);
if(f.exists) {
print("Opening " + f.name);
......@@ -173,6 +175,7 @@ for(var d = 0; d < dir_list.length; d++) {
f.close();
} else {
alert(dir.path + file_getname(listfile) + " does not exist");
continue;
}
}
else {
......@@ -241,7 +244,14 @@ for(var d = 0; d < dir_list.length; d++) {
}
}
}
if(listpath && options.delete) {
if(verbosity)
print("Deleting list file: " + listpath);
if(file_remove(listpath))
print("List file deleted: " + listpath);
else
alert("Failed to delete list file: " + listpath);
}
filebase.close();
}
print(added + " files added");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment