From bccae90227a659ed241d6a010deece439c0bedd2 Mon Sep 17 00:00:00 2001 From: Rob Swindell <rob@synchro.net> Date: Wed, 23 Feb 2022 18:01:21 -0800 Subject: [PATCH] Add -file=name|pattern option to specify files to add/update postfile.js still should be used for adding a single file to a filebase, but when updating a single file, this seemed like a simple enhancement. It also allows filtering of files to be added by wildcard (e.g. *.zip), so potentially useful for adding files too. Address enhancement request #348 --- exec/addfiles.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/exec/addfiles.js b/exec/addfiles.js index 2df8fb4e9c..a2c85630f6 100755 --- a/exec/addfiles.js +++ b/exec/addfiles.js @@ -37,6 +37,7 @@ var listfile; var date_fmt; var options = {}; var exclude = []; +var include = "*"; var dir_list = []; var verbosity = 0; for(var i = 0; i < argc; i++) { @@ -51,6 +52,7 @@ for(var i = 0; i < argc; i++) { writeln(" -all add files in all libraries/directories (implies -auto)"); writeln(" -lib=<name> add files in all directories of specified library (implies -auto)"); writeln(" -from=<name> specify uploader's user name (may require quotes)"); + writeln(" -file=<name> specify files to add (wildcards supported, default: *)"); writeln(" -ex=<filename> add to excluded filename list"); writeln(" (default: " + default_excludes.join(',') + ")"); writeln(" -diz always extract/use description in archive"); @@ -79,6 +81,10 @@ for(var i = 0; i < argc; i++) { options.auto = true; continue; } + if(opt.indexOf("file=") == 0) { + include = opt.slice(5); + continue; + } if(opt.indexOf("from=") == 0) { uploader = opt.slice(5); continue; @@ -187,6 +193,8 @@ for(var d = 0; d < dir_list.length; d++) { file_list.push({ name: file_getname(list[i]) }); } } + file_list = file_list.filter(function(obj) { return wildmatch(obj.name, include); }); + for(var i = 0; i < file_list.length; i++) { var file = file_list[i]; -- GitLab